[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [PROPOSAL] a new function: table.proto()
- From: Duncan Cross <duncan.cross@...>
- Date: Tue, 4 May 2010 12:33:32 +0100
2010/5/4 Michal Kolodziejczyk <miko@wp.pl>:
> The OP wants the table initialized with some known keys/values, so it is
> more than the initial size alone.
Check again - he's going through the keys and setting their value to
*nil*, which looks to me like the only purpose is to force
rehashing/resizing.
On Tue, May 4, 2010 at 10:36 AM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> The reason for not exporting it as part of the public API is that it
> exposes the implementation detail that tables have a hash part and an
> array part. But it really can be _useful_...
Well, I'd argue that the arguments of such a function would just be
ignoreable hints, and it could be explicitly stated that individual
implementations are free to use them if appropriate or just return a
normal empty table. But, yeah, I'm not entirely sure that's a very
solid argument.
On Tue, May 4, 2010 at 12:12 PM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> But the point is that we don't need to add to the public API to get
> this functionality exposed.
Absolutely, but then again in contexts where you don't have control
over the C side and are not at liberty to import arbitrary C modules,
or you'd like to use it in a general-purpose reusable Lua module (like
an OOP library), it would be less of a problem if there was a standard
way.
-Duncan