lua-users home
lua-l archive

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


Personally, I think all expressions should return values. To me, Lua feels a
lot like scheme, except that expressions don't return values. Another thing
you could do if assignments returned values is:

x = y = z = 0

> From: Oscar Lazzarino <osk@cclinf.polito.it>
> Organization: Politecnico di Torino
> Reply-To: lua-l@tecgraf.puc-rio.br
> Date: Tue, 27 Mar 2001 07:57:57 +0200
> To: Multiple recipients of list <lua-l@tecgraf.puc-rio.br>
> Subject: Re: ? assignments are not expressions ?
> 
> "Michael T. Richter" wrote:
>> 
>> [snip snip]
>> Making assignment not be usable inside an expression eliminates a fairly
>> common source of irritating (and sometimes devastating) error at the
>> expense of adding a single extra line of code in most circumstances where
>> it would be used.  I think this is a fair trade-off myself, and I would beg
>> that Lua's creators not turn assignment into an expression.
> 
> I don't really agree. You just have to use some self-discipline. And if
> you don't like the costruct, you're not forced to use it... But you
> can't deny that 
> 
> while ( X = read() )
> do
> print ( X )
> end
> 
> is by far nicer and CLEARER than
> 
> X = read()
> while X
> do
> print ( X )
> X = read()
> end
> 
> I would really like to see this FEATURE added to 4.1. Why don't we start
> a poll?
> 
> Oscar Lazzarino
>