Self (as Parameter)
The method used for passing parameters containing the current object (the self or current_object variable) has been changed. In all prior revisions of DataFlex, the value of self might change if the message is delegated. This has been changed so that:
The value of "self" passed as any parameter in a message is always the value of the original object that sent the message.
Consider the Following Structure
Object oA is a cClassA
Object oB is a cClassB
Object oC is a cClassC
Object oX is a cClassD
Send Foo of oC self
The message Foo is sent from oX, passing the variable self to object oC.
Prior to DataFlex 8.2
- If the message is resolved by
oC, thenself = oX. - If the message is resolved via delegation by
oB, thenself = oC. - If the message is resolved via delegation by
oA, thenself = oB.
In DataFlex 8.2 and Higher
The value of self will always be oX, the original object that sent the message.
To avoid this behavior, we always advised developers not to pass self as a single parameter or within an expression if they were not certain that the object receiving the message could resolve it. This created code that looked like this:
// Workaround required prior to 8.2
Procedure DoSomething
Handle hoSelf
Move self to hoSelf // Move self to a local variable before passing it in a message
Send MyMessage to oSomeObject (value(hoSelf,0))
End_Procedure
This type of workaround is no longer required, and you can now code this as follows:
Procedure DoSomething
Send MyMessage to oSomeObject (value(Self,0))
End_Procedure
We do not expect that this will negatively affect any existing programs, as the old behavior was not something that you would ever want to take specific advantage of. The only possible effect might occur if your program is currently not working properly, and somehow your program bug was neutralized by the old behavior – this is very unlikely.