To all hmg4 core developers, an important proposal
Posted: Fri Aug 05, 2011 9:11 pm
I already told that I think that release method should be studied a bit upon.
To me, release() should never delete the window itselft and its
objects recursively. It should never call __objDelData (if I previusly
said that it should do, I was wrong).
I try to explain why:
Imagine you have class window and 2 istances, like in:
W1 := Window():New()
W2 := Window():New()
If we add a label called "label01" to W1 internally hmg4 calls
__objAddData( w1, "label01")...
unfortunately, __objAddData (that is a internal function and should
not be called directly) adds label01 TO THE CLASS and not to the
instance !!!
You can check this with ? W2:label01 that returns NIL and doen't raise
an error !!!!!!!!!!
So, this must be taken care of, it's not really a problem, everything
is working... but programmers should know that it is unreliable to
test for method/data existance to understand which object we are
dealing...
Suppose that W2 goes out of scope earlier than W1... when it goes out
of scope, and we call __objDelData recursively... ooopss, label01
disappears ?!
To me, release() should never delete the window itselft and its
objects recursively. It should never call __objDelData (if I previusly
said that it should do, I was wrong).
I try to explain why:
Imagine you have class window and 2 istances, like in:
W1 := Window():New()
W2 := Window():New()
If we add a label called "label01" to W1 internally hmg4 calls
__objAddData( w1, "label01")...
unfortunately, __objAddData (that is a internal function and should
not be called directly) adds label01 TO THE CLASS and not to the
instance !!!
You can check this with ? W2:label01 that returns NIL and doen't raise
an error !!!!!!!!!!
So, this must be taken care of, it's not really a problem, everything
is working... but programmers should know that it is unreliable to
test for method/data existance to understand which object we are
dealing...
Suppose that W2 goes out of scope earlier than W1... when it goes out
of scope, and we call __objDelData recursively... ooopss, label01
disappears ?!