[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: a new proposal for environments
- From: Duncan Cross <duncan.cross@...>
- Date: Thu, 25 Feb 2010 20:19:12 +0000
On Thu, Feb 25, 2010 at 8:12 PM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> > I do not see why Lua should provide a function that you can build
>> > yourself, only to save a few lines in the construction of some very
>> > specifics sandboxes. E.g.,
>> >
>> > do
>> > local setupvalue, loadfile = debug.setupvalue, loadfile
>> > function myloadfile (fn, env)
>> > local f, err = loadfile(fn)
>> > if not f then return f, err end
>> > setupvalue(f, 1, env)
>> > return f
>> > end
>> > end
>>
>> Well, there are a lot of functions you could "write yourself", but in
>> the interest of ease of use and sensibility they're included by
>> default. I think you could also say that 'loadin' could be written on
>> your own, using almost exactly the same example.
>
> I guess I added an extra comma. Lua does provide several functions that
> you can write yourself, but usually they are useful in many situations,
> not only to build very specific sandboxes.
>
> -- Roberto
>
I apologise for selectively quoting like that, it was bad form. (I am
not entirely convinced that the only reason you would ever want to use
a "loadfilein" is sandboxing, but then in truth I don't have an actual
counterexample to support that. Sorry for the noise, anyway.)
-Duncan
- References:
- Re: a new proposal for environments, Peter Cawley
- Re: a new proposal for environments, David Kastrup
- Re: a new proposal for environments, Enrico Colombini
- Re: a new proposal for environments, Duncan Cross
- Re: a new proposal for environments, Jonathan Castello
- Re: a new proposal for environments, Pierre-Yves Gérardy
- Re: a new proposal for environments, Jonathan Castello
- Re: a new proposal for environments, Roberto Ierusalimschy
- Re: a new proposal for environments, Jonathan Castello
- Re: a new proposal for environments, Roberto Ierusalimschy