lua-users home
lua-l archive

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



On Sun, Apr 2, 2017 at 2:47 PM, Patrick Donnelly <batrick@batbytes.com> wrote:
BTW, I find it unnecessarily passive aggressive to assert Lua et al.
are "reinventing" Scheme. It is the very nature of all (spoken and
artifical) languages to borrow (or steal) from each other. I don't go
out of my way to cite French whenever I pass out my resume (or spell
it to their standards for that matter).


I'm not in any way trying to suggest that the authors of Lua are trying to reinvent Scheme. I'm actually quite impressed with the balance between the power of the language, its simplicity, and the ease of interfacing it with external code. All of that in a bit over 24000 lines of code (about 16600 if you strip comments and blank lines).

In my opinion (and it's just an opinion) there's a bit much of "if we add this feature it fixes today's problem" going on on this list. It's a good thing the Lua authors do not implement 99% of the ideas, because we'd be looking at yet another language that tries to be everything to everybody.

I'm not against adding features to improve the early releasing of resources, but adding a C# style 'using' clause or similar only fixes a part of the problem. This one leaks too:

for line in io.lines("myfile")
do
  if pattern:match(line) then break end
end

io.lines only closes the file if it hits the end of file, or when the garbage collector catches up with the abandoned file. Is there a way to catch cases like this as well? I don't know, but it would be nice to consider any options before copying an existing solution from C#/Go/Scheme or whatever other language there is.