[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: explicit mode
- From: Sean Conner <sean@...>
- Date: Tue, 10 May 2016 13:20:14 -0400
It was thus said that the Great Soni L. once stated:
>
> > To me, upvalues as part of a function signature reminds me of making
> >exceptions part of the function signature in Java---it may be a nice idea
> >to
> >be explicit about such things, but it gets annoying quite fast (and you get
> >aorund it by subclassing RuntypeException). It would also seem to be
> >repeating yourself in code quite often.
> >
> local function f() <>
> return function() -- no _ENV in enclosure, no _ENV in function
> return x -- error, no _ENV
> end
> end
Wouldn't this need to be?
local function f() <>
return function()<>
return x
end
end
And this brings up another point:
local print = print
local cache = {}
local function f()
return function(key) <print,cache>
print("DEBUG: key is ",key)
return cache[key]
end
end
Or should it be:
local function f() <print,cache>
return function(key) <print,cache>
print("DEBUG: key is ",key)
return cache[key]
end
end
I could make an argument for both cases. And is this for safety, or for
easy of serialization?
-spc
- References:
- explicit mode, Viacheslav Usov
- Re: explicit mode, Luiz Henrique de Figueiredo
- Re: explicit mode, Viacheslav Usov
- Re: explicit mode, Chris Berardi
- Re: explicit mode, Viacheslav Usov
- Re: explicit mode, Michal Kottman
- Re: explicit mode, Viacheslav Usov
- Re: explicit mode, Soni L.
- Re: explicit mode, Sean Conner
- Re: explicit mode, Soni L.