Currently, static properties aren't really possible since the property has to be defined in a base
-- or to put it another way, x.Property
has different meaning depending on whether x
is the exact class which defines Property
, or a subclass or instance. Although this is consistent with meta-functions, it's inconsistent with methods and falls short of the goal, which was to provide a "more foolproof" alternative to meta-functions (for the most common cases).
Instead, I'm considering changing it so that properties are also invoked when the class which defines the property is accessed. The cost would be:
- A small amount of flexibility. Invoking a property from a specific class on some other object (formerly Class.Prop.get(obj)) would involve retrieving the property using a more roundabout method, such as a for-loop or hypothetical ObjRawGet function. However, rather than designing a property to be used that way, one could put the needed code in a separate method. It's also true that flexibility isn't the real purpose here; meta-functions already provide that.
- A marginal performance hit. If retrieving an object from within another object takes 0.00014ms, it might take 0.00001ms longer due to a dynamic type check (is this object a Property?). However, I think the added user-friendliness is worth the price.
Anyone have thoughts on the matter?