Navigation:  Programming Cookbook > External Interfacing > External Structures >

Dynamic Field Access

Previous pageReturn to chapter overviewNext page

Having defined an external structure class in this way, we'd have an uncompiled structure with dynamic field access. Uncompiled structures dynamically access their fields by overriding the #doesNotUnderstand: message that the VM sends to an object when it determines that the object does not implement a method for the message being sent. For example, if we send one of our POINTLs the message #x then the VM will create a Message containing the selector and arguments (in this case there are none), and pass that Message to the #doesNotUnderstand: method of ExternalStructure, which will attempt to access the field named by the selector. In this case it will be successful (the template contains an entry for #x), but otherwise the usual run-time error walkback will result.