[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: builtin types
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 25 Nov 2009 15:37:24 +0200
On Wed, Nov 25, 2009 at 2:15 PM, spir <email@example.com> wrote:
> Maybe an option would also be to have access to real types ('table', as well as 'string', file',...) that would really be used to create objects.
Idle already defines table.new() as a special constructor which
creates tables with their metatable __index pointing to 'table'. It is
almost trivial to write a Lua function to do this.
But, I don't think that 'inheriting' from the standard types makes
that much sense. For one thing, all strings share the same metatable;
yes, it's possible to do interesting things to that metatable, but
that is then a change effecting _all strings_. In the same way, all
functions share a metatable.
As for file, it's a userdata ... could be awkward to do mods to that from Lua.
I suppose Lua does not subscribe to the idea that 'all things are
objects', certainly not in the standard inheritance way.
Most of us consider this to be a Good Thing.