[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Syntactic sugar cravings
- From: "Jay Carlson" <nop@...>
- Date: Mon, 23 Jul 2001 21:31:12 -0400
I'm getting tired of typing
for i=1,getn(l) do
local v=l[i]
[...]
end
It makes the loop look more complicated than it is, harder to understand at
first glance etc. What I'd like is something like
for i,v in list l do
[...]
end
with whatever surface syntax makes sense. "for i,v in l[] do" or "forlist
i,v in l do" or whatever. I guess "for i,v inlist l do" would have the
fewest grammar implications.
Also, I think I'm going to implement the following in my interactive lua
command loops:
=2+2
is an abbreviation for
_EVAL_PRINT(2+2)
where _EVAL_PRINT is initially set to print. It gets a separate hook to
allow for pretty-printing of tables. I considered flipping the default and
using ; to prefix statements but that doesn't allow you to paste code into
the loop.
Jay