lua-users home
lua-l archive

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


On Sat, Nov 27, 2010 at 18:34, Matthew Wild <mwild1@gmail.com> wrote:
> On 27 November 2010 15:22, Alexander Gladysh <agladysh@gmail.com> wrote:
>> On Sat, Nov 27, 2010 at 16:55, Cosmin Apreutesei
>> <cosmin.apreutesei@gmail.com> wrote:
>>> This is a small C module by Matthew Wild that adds a debug.getsize()
>>> function which returns the size in bytes of a Lua object.

>>> Homepage: http://code.matthewwild.co.uk/lua-getsize/summary

>>> I found it useful so I packaged it and added a small test unit -
>>> tested in win32 and linux64. Grab it while it's hot:
>>> http://code.google.com/p/lua-aux-lib/downloads/list.

>> Thank you for the useful contribution.

>> But why does this module change a standard namespace?

> It's a debugging function. it's very implementation-specific. It
> belongs with other debugging functions. It's overkill to make a new
> namespace for a single function.

It is much worse to change standard namespace.

What if somebody else will make a function with the same name but
other semantics?

> I can however check that it isn't overwriting an existing "getsize"
> field. I would indeed love Lua to have such a function built-in
> (getsize depends on internal Lua header files), but I don't ever
> expect it to, so I really see no harm in it for a module as small as
> this.

Anyway, using modules that change standard namespaces is explicitly
forbidden in our internal coding guidelines.

(Can't say that I see that need to use this module in our code right
now though.)

Alexander.