[Gambas-user] Issue 172 in gambas: Using static symbols on objects not consistent
gambas at ...2524...
gambas at ...2524...
Wed Dec 28 16:40:32 CET 2011
Comment #6 on issue 172 by benoit.m... at ...626...: Using static symbols on
objects not consistent
http://code.google.com/p/gambas/issues/detail?id=172
There is no "dynamic" constant.
The point is that you are using a symbol on an object reference, and the
symbol kind (constant, property... static or not) is known at runtime only.
By allowing using static symbols on reference too, not just on the class
name, allows to change the class implementation without breaking the
existing code.
I have the case with the IDE, with some singleton classes. The unique
object of these classes have a read-only "Name" symbol, that is actually a
constant, not a dynamic property or variable. It is faster, as constants
access are optimized at runtime.
And later I can choose to make a constant, or a true property, or a
variable, without breaking the existing code.
Of course, the programmer must know what the class does. Otherwise he may
get strange things like you point in the message #4.
More information about the User
mailing list