That sounds like a great idea. I don't think many people use such systems where the memory used by programs (not instances or raw data) is significant at all...
/ Mirar
Previous text:
2003-12-22 09:26: Subject: C#-like properties
accessor-functions would be nice, but they would incur significant overhead. In particular, looking up the `-> and `->= functions can be done in O(1) time, but looking up a function with a varying name currently takes O(log(n)) time (where n is the number of functions in the class) In a language with static binding, this is of course not a problem. Unfortunately pike only has static binding within objects, as soon as you call another object, dynamic binding is used.
A workaround for this problem would be to convert the method lookup function to use a hash-table instead of a binary seek. That way, method lookups would *always* be O(1), and while accessor functions would still incur some overhead, it wouln't be nearly as bad. (Also, converting the lookup function would make it possible to get rid of a function lookup cache, which could be a very nice net gain.)
The drawback is that hash tables use a bit more memory than binary seeks, but I don't think that's a major issue in this day and age. Especially since memory usage is linear to the total number of functions in the program, not the number of instances.
/ Fredrik (Naranek) Hubinette (Real Build Master)