lua-users home
lua-l archive

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>> 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 when you maintain the code of someone who doesn't have that
self-discipline....

> 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 certainly can and do deny that claim.  Burying an assignment inside the
test of a loop construct is just plain evil.

- --
Michael T. Richter
"Be seeing you."

-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.5.3

iQA/AwUBOsA9CrTM3QkE7U/oEQJwIwCeMZFIgLKZzG2zqf9jIFS6U3nFIRwAn1ur
ZKlZ18v4fPMwXdcmtSCFDzXp
=CXYR
-----END PGP SIGNATURE-----