lua-users home
lua-l archive

Re: Lua 5.1 (work6) now available

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


Adriano Ferreira wrote:
Each one of these operators or prefixes (* or #) has its load of
meanings in another programming languages. It is difficult to chose
which one makes more sense in the context of Lua.
For example,
* (C/C++) - dereferencing pointers in expressions - declaring pointer types in declarations
* (Ruby, Python, Perl6)
 - syntactic sugar for what Lua unpack does: f(*p) = f(p[0], p[1], ...)
 In Perl 6 known as the splat operator
# (Smalltalk)
 - used as a prefix for Symbols (which are Smalltalk parlance for
Lisp/Scheme atoms)
But why have a primitive operator for this at all? It seems like having a library function call to return this information would be sufficient. In fact, Lua has such a thing, or more precisely it has two, right? One to return the number of contiguous numeric indices and one to return the total number of properties. So why the operator? I think adding modulus '%' is a good idea because this is such a fundamental operator. But if you want to add new operators, then the bitwise operators or '+=', etc. would seem like a better choice, wouldn't it?
--
chris marrin ,"",ドル
cmarrin@arch.sel.sony.com b` $ ,,.
(408) 955-3049 mP b' , 1$'
Sony ,.` ,b` ,` :$$'
 ,|` mP ,` ,mm
 ,b" b" ,` ,mm m$$ ,m ,`P$$
 m$` ,b` .` ,mm ,'|$P ,|"1$` ,b$P ,` :1ドル
 b$` ,$: :,`` |$$ ,` $$` ,|` ,$,,ドル`"$$ .` :$|
b$| _m$`,:` :1ドル ,` ,$Pm|` ` :$,ドル..;"' |$:
P$b, _;b$$b1ドル" |$$ ,` ,$$" ``' $$
 ```"```'" `"` `""` ""` ,P`
"As a general rule,don't solve puzzles that open portals to Hell"'

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