lua-users home
lua-l archive

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


It was thus said that the Great Lorenzo Donati once stated:
> 
> I wouldn't mind if Lua allowed an optional syntax for specifying what 
> "end" ends; optional but enforced if used, i.e. an error would be issued 
> if (say) "end for" didn't end a for structure.
> 
> I can't say if it would be too heavy for the compiler or if a nice 
> syntax could be devised that didn't render the grammar too complicated
> 
> For example:
> 
> end for         (ambiguous)
> vs.
> end for;
> vs.
> end ---for      (semantic comments?)
> vs.
> end ::for::     (fake label? ambiguous)
> vs.
> <choose your poison!>

  Here are some other options:

	function() ... endfunction
	if ... then ... endif
	while ... do ... endwhile
	for ... do ... endfor
	do ... enddo -- hmm ... 

Okay ...

	function() ... noitcnuf
	if ... then ... fi
	while ... do ... elihw
	for ... do ... rof
	do ... od --- hmm ...

  The do keyword is problematic.  Several constructs use it, but it can be
used on its own to intruduce a new lexical scope.

  In my own code, I don't think I've ever used a semicolon.

  -spc