[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: loadstring vs load
- From: Peter Cawley <lua@...>
- Date: Fri, 10 Dec 2010 16:36:07 +0000
On Thu, Dec 9, 2010 at 4:30 AM, David Manura <dm.lua@math2.org> wrote:
> On Wed, Dec 8, 2010 at 6:29 AM, Roberto Ierusalimschy
> <roberto@inf.puc-rio.br> wrote:
>>> Is there still a good reason to continue using loadstring?
>> No.
>>> Is it scheduled for deprecation?
>> Probably it will be.
>
> It would be possible to deprecate load as well, in favor of loadin. I
> wonder why 5.2-alpha didn't redefine load as such:
>
> load (ld [, source [, env, [, mode]]])
The way it stands at the moment, load() will accept a bytecode chunk
with no upvalues, whereas loadin() will reject a bytecode chunk with
no upvalues. I would certainly be in favour of combining load() and
loadin(), though I would go for "load (ld [, source [, mode, [,
env]]])" as otherwise you couldn't use the default environment with a
custom mode parameter (as a nil environment is a valid environment),
and I'd also like the resulting function to accept bytecode chunks
with no upvalues.