lua-users home
lua-l archive

Re: suggestions for new version

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


wish[1] An efficient case selection structure would be nice, to avoid the
 overhead of long if-elseif...else-end constructs. I can do something
 similar (but not very efficient) now with:
 dostring(switch_list[selector])
 ...or with a table of functions which are used for their side-effects,
 but it would be hard for someone else reading the code to see what was
 happening; much better to localise the code at the point in the source
 where it is to be used.
 I presume it would be fairly easy for the compiler to plant a hidden
 jump table without requiring any new opcodes or anything.
 I'm not very bothered about having C's "fall-through" switch
 architecture, however. I'd happily give up typing 'break' at the
 end of cases and just accept an implicit and un-overrideable one.
 I don't really miss 'for' loops, but the above is an efficieny issue
 so I thought I'd raise it.
wish[2] A hook into the raw uncompiled input before the lexer sees it, so I
 can use a regexp parser to add my own syntactic sugar for the "end
 user". I can see a use for this in providing meaningful operations
 on userdata, and it would fit in well with lua's policy regarding
 debugging: don't provide a pre-processor, just the hooks to allow
 one to be built.
Other minor things:
* hex literals and bit-operators are useful if you are talking to hardware,
 but the operators would need a new fallback for the cases where casting
 a double to an int leads to loss of information (a 'range' fallback?).
 I've implemented the operators as functions (looks ugly) and patched
 "lex.c" manually to get the literals already, so _my_ vote goes to
 the form '#1234abcd' (case-insensitive), since that would give me
 *forwards* compatibility! ;-)
* iolib lacks the converse of ascii(str), but it's trivial to write
 a C function for char(n).
That's just about all I can think of; I *like* the elegant terseness in
lua so I wouldn't want to see a great deal more...
-- 
Mark Ian Barlow Non-Linear Control Consultants Ltd.
-----------------------------------------------------------------
Mark@nlcc.demon.co.uk Voice / Fax: +44 (0)1207 562 154

AltStyle によって変換されたページ (->オリジナル) /