Subtle Io pitfalls[edit | edit source]
Object initialization[edit | edit source]
A := Object clone do( ... init := method( ... ) )
Now, you can use the
A object, but the
A object is not yet initialized
init method). The
is only called when the
A object is cloned. This can for instance "bite" you if you
implement your own
clone method for an object.
Reading variables/slots that contains activable objects[edit | edit source]
If a variable/slot is assigned with an activable object, you need to use getSlot("varname") to get the same object. Otherwise, the object will be activated and you will get the result of the activation instead. One such activable object is a method.
For example, if you want to do some introspection, and inspect the methods of an object:
method_to_inspect := Object getSlot("asString") # print the code of this method getSlot("method_to_inspect") code println # error, (Object asString), a String, doesn't understand the code message method_to_inspect code println
Bugs[edit | edit source]
Self Referential Prototype[edit | edit source]
Trying to set the prototype of an object to the object being contained by that object like this:
A := Object clone do( B := Object clone B appendProto(A) )
Can cause IoVM to die with
Segmentation Fault. You need to replace that code with something that looks like this:
A := Object clone A do( B := Object clone B appendProto(A) )
A is known to the parser but has no sane value in memory in the first use, so it tries to append invalid memory to the list of prototypes. In the second form the slot is both known to the parser and also filled with a valid object, so it works.