lua-users home
lua-l archive

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


On Sun, Jan 28, 2018 at 11:24 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2. In a for statement, allow extra conditons before the 'do'.
> 2a.
>
> for _,item in ipairs(list) if type(item)=='table' do
> ...
> end

I do like this sugar! One less block level, and it's a common pattern.

Been spending a lot of time using Rust, and the

for x in list.iter().filter(|x| some_condition(x)) {
...
}

pattern is great. Naturally, this pattern is possible in Lua (although
closures are a bit more verbose) but Rust can make this as fast as
hand-rolled ifs.

Kenneth mentioned C-like line directives, and anybody who has
_generated_ Lua has missed these. I went to a lot of trouble in
LuaMacro to preserve original line information, and it was not easy!

Finally, some standard for type annotation - which can be through
preprocessing - would be most helpful for large code bases. Currently
we use documentation for something that could be encoded in argument
types; I think TypeScript could be a source of inspiration since
Javascript thinks very much like Lua.  Once there's a standard, then
tooling can be built on top of it, and reliable navigation and code
completion becomes possible.

Like Sean says, support for hardware breakpoints is very useful for
'Big Lua' and I believe the Adobe guys did some work in this
direction.