Methods that have special side effects, or are called automagically at certain times.
If you try to call a message on an object, and that message is not defined (nor in parent objects), but forward is, then forward will be called. It can be used to handle these cases (attributes that aren't found).
Inside forward, the name of the message that was not found can be retrieved by call message name.
MyObject forward := method(
writeln("You tried to access: ", call message name)
)
The manual has several other ways to get information:
call sendercall message arguments to get the arguments (if any) passed to the non-existent message; these arguments are unevaluated at this pointcall message argsEvaluatedIn(call sender) to get the arguments (if any) passed to the non-existent message, evaluated in the context of the sender(More about the Call object.)
(todo...)
Not really "magic", but this is called when print and friends (or the interactive interpreter) need a string representation of an object. Similar to __str__ in Python. For example:
Io> m := Map clone
==> Map_0x7447a0:
Io> m
==> Map_0x7447a0:
# change asString...
Io> Map asString := method("je grootje!")
==> method("je grootje!")
# try printing m...
Io> m
==> je grootje!