lua-users home
lua-l archive

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


Paul,

> Why do we need the ugly, weird-looking and controversial <toclose> notation at all?

Indeed, so many people don't like it, but fail to notice one thing.
You don't have to use it!

local function scope(object)
    return next,{[object]=1},nil,object
end

for file in scope(io.open("file")) do
    print("I can use file ",file)
end

print"File has been closed!"

People trying to get others to use variants of 'with' don't notice
it's there already.

Please. Things are going fine.

Best regards,

-- 
DoubleF