[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Simple pickler
- From: Luis Carvalho <carvalho@...>
- Date: Thu, 17 May 2007 10:23:40 -0400
> Funny, I was just at the point of writing exactly that sort of thing,
> though based on my own, more Perl-oriented pack/unpack code.
Well, it kinda asks for it, isn't it? :)
> One quick remark after skimming the code. In pickle() I see this:
> > elseif t == "string" then
> > return pack("BBc0", TSTRING, #o, o)
> and further down this:
> > elseif t == "function" then
> > local f = dump(o)
> > return pack("BBc0", TFUNCTION, #f, f)
> If I understand the documentation for Roberto's struct library
> correctly, "BBc0" won't allow strings or functions longer than 255
> bytes. Shouldn't the pack code be "BHc0" (max. 65535) or even "BLc0"?
> (Of course, unpickle() would have to change accordingly.)
> Or am I missing the obvious?
No, I missed the obvious. You are right. I just took this code from one of
Roberto's examples while I was playing with struct and forgot to adapt it
A mathematician is a device for turning coffee into theorems.
-- P. Erdos
Applied Math PhD Student - Brown University
PGP Key: E820854A <firstname.lastname@example.org>