[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: new "empty" value/type in Lua?
- From: Petite Abeille <petite.abeille@...>
- Date: Mon, 1 Jul 2013 20:40:44 +0200
On Jul 1, 2013, at 8:04 PM, Roberto Ierusalimschy <email@example.com> wrote:
>> Couldn't a lot of ambiguity and unexpected behavior avoided by keeping
>> nil but introducing two new functions to the table library called
>> "table.has(t,key)" and "table.delete(t,key,[to])" - and dropping the
>> deletion via assigning nil?
> At last something new and worth a discussion. Does anyone see problems/
> incompatibilities/etc. with this?
I, for one, find this an unnecessary and taxing complication, pandering to a minority taste.
Unnecessarily because, if one care enough about it, one can use placeholders and/or metamethods to shape a table whichever way one sees fit.
Taxing because, under such a schema, what used to be a primitive, immediate table operation ( t[ k ] = nil ) has become an esoteric, indirect library operation ( table.delete( t, k ) ).
Minority taste because, while not beyond useful every now and then, it's not worth the overall quotidian complications.
A bit of the perfect (full fledge nil support) being the enemy of the good (primitive key removal).
Just my 2¢.