lua-users home
lua-l archive

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


On Wednesday 25 January 2006 19:44, Chris Marrin wrote:
[...]
> I haven't looked into it closely enough, but
> I have the feeling that it would not be hard to add the ability to mark
> a function as "member" or not.

Yes, it would be hard, and it would radically change the way the language 
works. (Python does this. I invite you to go and look at the way it works and 
then decide whether you think it's a good idea...)

FWIW, Raffaele Salmaso wrote a very neat object system based on closures where 
you used . to invoke methods. Pluses: the syntax change; instance data in 
methods was stored as upvalues, not table entries, making them an order of 
magnitude faster to access. Minuses: constructing objects was far more 
expensive, as you had to construct new closures for all the methods to bind 
the self parameter in. If you're interested, he posted his code to the 
mailing list; look for December 2004.

(We should really be collecting object systems on the Wiki. There's a fair 
number, all with different and useful properties.)

-- 
+- David Given --McQ-+ "...electrons, nuclei and other particles are good
|  dg@cowlark.com    | approximations to perfectly elastic spherical
| (dg@tao-group.com) | cows." --- David M. Palmer on r.a.sf.c
+- www.cowlark.com --+ 

Attachment: pgpi6I1cbmOmZ.pgp
Description: PGP signature