lua-users home
lua-l archive

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


"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