As I was drifting off to sleep last night, this popped into my head. I didn’t feel like getting up to write it down. It was a pleasant surprise that I remembered it when I woke up.
It’s a set of structures for setting up a message passing language that supports single inheritance. Kind of like Smalltalk or Objective-C.
Property
name
value
Method
name
listOfParameterNames
pointerToImplementation // likely a C function
Structure
name
pointerToSuper
listOfProperties
listOfMethods
Message
listOfProperties
##Send A Message
pass pointerToStruct
pass pointerToMessage
if MatchMethod
Call Method with Parameter of Properties
else
Send Message to Super
FindProperty
if exist struct.property with same name
return struct.property
return FindProperty(struct.super, property)
FindMethod
if exist struct.method with same name
return struct.method
return FindMethod(struct.super, method)
MatchMethod
thisMethod = FindMethod(method)
if thisMethod
For each message.Property
if not exist FindProperty(struct, message.property)
thisMethod = nil
break
BindProperty thisMethod, thisProperty
return thisMethod