Normally, if your code calls a property routine using obj.prop(), then in
the obj.prop routine the "self" variable will be set to obj.
However, if you call the routine indirectly, like this: ..."self" will not be set correctly (it will retain the value it has in
the calling routine). None submitted. This isn't a bug, because you are not sending a message. Notice that the
code will crash if prop is not a routine, while a message send would either
print the string if the value is a string, or return it if not. The
obj.prop(args) format is required for a message send. What the code example
does is store obj.prop (the address of the routine) in a. It then calls the
routine at the address stored in a. It seems deliberate that the veneer works this way,
and IMHO it shouldn't be changed, just better documented.
About Patches
Issue C62106
Indirect call doesn't set "self"
Submitted by: Brendan Barnwell and L Ross Raszewski
Appeared in: Compiler 6.21 or before
Fixed in: -
Problem
a=obj.prop;
a();
Solution
Update (by Eric Schmidt)
Update (by Cedric Knight)
Last updated 17 April 2013.
This site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation.
Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Roger Firth.