[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Propsoal: a lua dialect without nil
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 15 Feb 2011 14:40:28 +0200
On Tue, Feb 15, 2011 at 2:27 PM, Matthew Frazier
> "does it equal nil." I'm borrowing from Python here, but "in" and "del"
> keywords for testing whether a key is actually *defined* in a table (i.e. "3
> in t") and deleting keys from a table (i.e. "del t") might be useful for
Nah, more operators - we have enough.
It is interesting to see how Go solved the problem, in a rather
Lua-ish way: return two values, with the second indicating whether we
actually found something, and are not just getting the default value.
Ruby has a way of making hashes  that specify the default value if
the key is not found.
And naturally it's not difficult to do this in Lua, but then we have
to break the habit of using raw tables for everything.
 honest, it was not intended as a joke..I think.