lua-users home
lua-l archive

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


On Mon, Oct 14, 2013 at 2:58 PM, Andrew Starks <andrew.starks@trms.com> wrote:
On Mon, Oct 14, 2013 at 6:38 AM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> Up to some point, consistency is overvalued.

This is a really interesting point that I'll have to think about. It
sits nicely with an earlier one that you made along the lines
over-checking types and productivity.

If I may represent the voice of inexperience, I view consistency as
food. If I see something that is inconsistent, then I imagine that the
world of unknowns to is actually much larger than I thought it was. I
try to work the inconsistency into an understanding and sometimes by
definition, that's impossible. It's just one more "except." It's also
the opposite of simple and may be the line between it and its
opposite: easy.

So, when I see `tostring(x)`, I expect that there is also `tonumber`
and `toboolean` and even `tonil` or totable, as nonsensical as the
last two might seem/be.

That's all. I don't have an actual opinion to share.

-Andrew


I suppose totable(x) would return x if it's a table[1], and nil if not. By extension, then, tonil(x) would return x if it's nil, and... nil if not. So that's not as useful.

[1] Strictly speaking, return x if it's a table or something that can be converted to one (and apply said conversion) - just as all the other to<type> functions work. But there's no other type that can be converted to a table.

--
Sent from my Game Boy.