lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo wrote:
> 
> >>   (a)=3; (print or write)(9)
> >
> >How is that going to work?  Will the ; be required in Lua 4.1?
> 
> Yes, in this case the ';' will be required to remove the ambiguity.
> I'm glad that ';' will now be useful (but not always required)!

Hmm...  up to now the ';' was really optional[1].  Now it makes a
difference.  If all cases where it is required would generate a
syntax error it would be ok.  But there are cases where both
interpretations are valid (i.e.  a=b ; (print)(9) ) and IMHO
that's not good.  It makes the language more fragile and complicated.
Maybe a standard identity function [1] (part of the baselib) would
be better.
 
> > [  (a)=3   ]
> 
> These will be valid in 4.1.

IMHO to let ()-expressions be l-values gives nothing new to the
language and just shows more limitations:

	(a) = 1  -- ok
	(b) = 1  -- ok
	(a and b) = 1  -- invalid
	(f()) = 1  -- invalid

Saying: '()' always generates a single value is IMHO cleaner.

Ciao, ET.

[1] I was even about to remove it from Sol completely.  But
remembering my first steps with Lua I kept it :-)

[2] function id(x) return x end