lua-users home
lua-l archive

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


On Sun, Jan 28, 2018 at 7:02 AM, Paige DePol <lual@serfnet.org> wrote:
> Dibyendu recently started a discussion about wether or not Lua has reached
> perfection. Of course, this will be a subject highly dependant on the need
> and opinions of each user of Lua.
>
> On that same discussion topic the desire for a switch/case like construct
> in Lua came up... so I thought I would start a new discussion thread to
> see what features people would like to see added to vanilla Lua.
>
> So, if you could add any one feature to Lua right now, what would that
> feature be and why would you want to see it added? Please note that this
> discussion is in no way meant to be interpreted as pressuring Team Lua to
> add any features to Lua, I am genuinely curious what features people want
> to see added to Lua and why.
>
> My interest in this subject isn't just academic, however, I may take some
> of these ideas on board to add to my hard fork of Lua. If so, I would also
> create patches for vanilla Lua as well! :)
>
> ~Paige
>
>

I'd like to see a safe table navigation syntax and a syntax for
constants that throw a compile time exception if you try to assign to
them after their declaration (The only allowable data types would be
boolean, number and string). Both can be mimicked with tables, but I
would argue that the implementations of safety should be a language
feature, not a manipulation performed using a data structure (tables).

In terms of switch/case statements, I like them because I can read
them quickly and I know that only a single item is being compared.
"ifelse" requires more thought (perhaps not a bad thing. tee hee). I
just think case statements provides a nice simplified condition
statement. Dare I say it would "clean the syntax up" for readability.
ifelse means I'm performing logic, switch means I'm checking options.

Sometimes I think a Ternary condition statement would be good. Then I
read C and decide against that. :(

Other things I think would be nice: the search path for modules
defaulting to the main scripts path if a full path is specified, and a
built in strict mode. Both features are available in penlight and many
other add ons.

Coming from the C# world, I can say it's wonderful that this
discussion can even be had. I think it vindicates the decision to keep
all these nice to haves out of the language itself. "Want more
features? There's the sources..." ;)

Russ