[Gambas-user] Issue 268 in gambas: Can call non-static _unknown from a static context

gambas at ...2524... gambas at ...2524...
Wed Jul 4 22:55:28 CEST 2012


Comment #7 on issue 268 by emil.len... at ...626...: Can call non-static  
_unknown from a static context
http://code.google.com/p/gambas/issues/detail?id=268

Some more things:
* What should happen if _property is static but _unknown is dynamic or vice  
versa? ;) This code:

Static Public Function _property() As Boolean
End

Public Sub _unknown(...)
End

Public Sub TestFunction()
   Me.uuh = 3
End

-> Segmentation fault (The gambas stack gets corrupted)

And

Static Public Function _property() As Boolean
   Print "This is not written to stdout"
End

Public Sub _unknown(...)
   Print "This is written to stdout"
End

Public Sub TestFunction()
   Me.uuh()
End

-> i.e. _property is silently ignored, but _unknown is executed.

* _property must also be checked in about the same way when a property is  
written to:
Static Public Function _property() As Boolean
   Print "This message will not be written to stdout."
   Return True
End

Static Public Sub _unknown(...)
   Print "Not this message either"
End

Public Sub TestFunction()
   Me.uuh = 3
End

-> Shows nothing on the screen, i.e. none of _property or _unknown are  
executed, and no error message.

* In revision #4894 you cannot call a static function when having an  
object, like obj.unknown_function(), err msg "static function". But the  
convension is that static functions can actually be called even if you have  
an object. obj.known_static_function() works.





More information about the User mailing list