Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

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

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:

  a=obj.prop;
  a();

..."self" will not be set correctly (it will retain the value it has in the calling routine).

Solution

None submitted.

Update (by Eric Schmidt)

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.

Update (by Cedric Knight)

It seems deliberate that the veneer works this way, and IMHO it shouldn't be changed, just better documented.


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.