lua-users home
lua-l archive

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

On Thu, 2006-01-26 at 14:39 +0000, Stephen Kellett wrote:
> In message <>, mnewberry 
> <> writes
> >easily accepted Lua will be. Just making syntactic sugar for -- and !- or
> >maybe {} for "then" seems to me to be the kinds of things that make Lua far
> >more palatable without really changing the architecture and capabilities of
> Indeed. The Ruby guys realized this early on. They deliberately added 
> things to make Perl users feel at home and other things just for ease of 
> use. I think failing to address the "syntactic sugar" issues raised in 
> this thread will slow the uptake of Lua.
> Its not as if the two main issues (!= and //) will change the language 
> to any great degree but it will smooth a lot of the awkward, stupid 
> mistakes that inevitably get made whilst learning a new language. Real 
> mistakes - ones where you are getting your head around a new concept - 
> they are great, you are learning, but stupid ones like != are just plain 
> annoying.
> Stephen

!= and // need no additional context to figure out what they mean.  !=
is obviously intended to be "not equal" and nothing else in Lua's
current syntax conflicts with or confuses this.  The closest thing to //
would be /, but no additional context is needed to differentiate the
two, one slash is divide, two is a comment. Neither of these is likely
to bother anybody if they get added in. A simple string.gsub pass over
the text of lua code that uses these can also very easily switch them to
"standard" Lua code.

{} for block delimiters, however, clashes violently with {} for table
constructors, and it NEEDS context to determine which is which. The
problem isn't, IMHO, that the parser couldn't be set up to understand
the difference; that would be easy enough for someone familiar with
Lua's parsing system. The problem is with Human Readbility. A few
examples have already been given. Also, string.gsub would not be able to
switch back and forth easily between {} and then/end. Having to do a
double take anytime you see {} is annoying when you're learning Lua,
it'd be annoying if you still had to after learning Lua.

By "learning Lua" I mean specifically, learning lua well enough to be
able to glance at lua code and say without doubt that it's lua code,
instead of C, C++, etc.


"If Ignorance is Bliss, I'll take the Pain."