Runtime Attribute Access


How can I set the value of a property on an object if I have the property name as a string at runtime? For example, if I want to set a specific directional exit property on a room at run time and I have something like

I looked at the section in the system manual regarding reflection, and the global symbol table, but I guess I am confused by it. If I look up a symbol like ‘north’, and then I do:

theRoom.(dirProp) = aDoor;

How exactly does it know that I’m trying to use the ‘north’ property of theRoom and not some other room. I guess I can’t quite wrap my head around how TADS3 would be able to do this, unless like - all ‘north’ properties somehow exist as the same underlying entry in the symbol table and that entry is a list of a the individual ‘north’ properties and once you use it with the . operator on an actual object like in theRoom.(dirProp) it finally resolves to the actual ‘north’ property for that room?

Is this how it works? And if not, is this the correct way to set a property on an object dynamically?


I just want to reply that yes this is indeed how it works.