lua-users home
lua-l archive

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


On Mon, Jul 1, 2013 at 12:16 PM, Hisham <h@hisham.hm> wrote:
> On 1 July 2013 15:04, Roberto Ierusalimschy <roberto@inf.puc-rio.br> 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?
>
> If I'm following correctly, code that uses t[k] = nil to clean up
> parts of a table would behave the same, but take up more memory,
> unless modified to use table.delete() ? If so, that would turn a
> "standard practice" into a compatible, but "bad practice"... I agree
> with Javier that this would be a major change. I don't know if I like
> the whole proposal or not, but this point I raised does sound like a
> problem to me.
>
> -- Hisham
> http://hisham.hm/
>

This is a valid point and it makes me wonder if perhaps there needs to
be an opt-in mechanism similar to creating a weak table.

/s/ Adam