lua-users home
lua-l archive

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

On Monday 29 August 2005 13.26, Rob Kendrick wrote:
> > Only End is mandatory, but I used to add the optional word all the
> > time. Same for Next <VariableLoopName>, the variable being
> > optional. 
> I always found this very useful - it meant that the compiler whinged
> at if you got it wrong - it's useful for confirming where each
> structure ends in your mind.

I've found that proper indentation, and an editor with the good old 
(at least in the Un*x world) "highlight matching brace" feature, 
pretty much eliminates the need for this kind of language features.

Besides, in many languages, you're hard pushed to make anything 
compile at all, if there is one brace too few or too many - although 
at least some of the GNU compilers tend to completely freak out and 
crash or give incomprehensible error messages in some of those cases.

However, I can't remember seeing an editor with a "highlight matching 
keyword" feature... One would need a list of open/close keyword 
pairs, so this propably falls in the language aware syntax 
highlighting domain - but most serious editors do that anyway, these 

> Alas, I don't think this kind of thing is possible to be implemented
> optionally in Lua, as it is in Basic, as the compiler wouldn't be
> able to tell the difference between the end or a beginning of a
> block. :-/

Well, if the "end of statement" rule is a problem, there's always the 
option of doing it in the form of "semi synonyms" that allow you to 
replace 'end' with 'endif', 'endsub' or similar. The token 
substitution filter would double as a hook for the extra checking.

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> -'
   --- --- ---