[Gambas-user] Issue 172 in gambas: Using static symbols on objects not consistent

gambas at ...2524... gambas at ...2524...
Wed Dec 28 16:32:29 CET 2011


Comment #5 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 in the IDE, with 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 (constants access are  
optimized at runtime).
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 he uses does. Otherwise  
he may be get strange things like you point in the message #4.





More information about the User mailing list