lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Roberto wrote:
> > On the other hand, it is not difficult to add a "with" to the language
> > that works with exceptions. All we have to do is to use the upvalue
> > system. This system already has all that needs to control when a
> > variable goes out of scope.
> 
> Yes, we laymen have known this at least since the non-local return
> discussion in 2005
> (http://lua-users.org/lists/lua-l/2005-08/msg00373.html).

I do not think you are a laymen. But I am not sure all "laymen" know
this, as several proposals seem concerned with handling exception
clean-up.


> I decided to put my energy into defining requirements and arguing the
> case for improved cleanup support rather than writing yet another
> implementation.

About requirements, what is wrong with Joonas Pihlaja's proposal?

  do with f, g = io.open("src.txt","r"), io.open("dst.txt",w")
     for l in f:lines() do
        ...
        g:write(l)
     end
  end

(Probably with a different syntax...)

-- Roberto