MyObject test // performs test MyObject ?test // performs test if MyObject has a slot named testThe search for the slot only follows the receivers proto chain.
Io> block(x, x*2) scope == thisContext ==> true
myObject foreach(n, v,
writeln("slot ", n, " = ", v type)
)
myObject foreach(v,
writeln("slot type ", v type)
)
Io> thisContext foreachSlot(n, v, n println) Lobby Protos exit forward n v ==> false
Example:
myProxy forward = method( messageName := thisMessage name arguments := thisMessage arguments myObject doMessage(thisMessage) )
Io> m := inlineMethod(x := x*2) Io> x := 1 ==> 1 Io> m ==> 2 Io> m ==> 4 Io> m ==> 8
Io> x := lazySlot("Evaluated!" println; 17)
Io> x
Evaluated!
==> 17
Io> x
==> 17
Io> x
==> 17
Io> lazySlot("x", "Evaluated!" println; 17)
Io> x
Evaluated!
==> 17
Io> x
==> 17
Io> x
==> 17
Dog := Mammal clone do( init := method( resend ) )Calling Dog init will send an init method to Mammal, but using the Dog's context.
Io> Object clone do(x:=1) serialized ==> Object clone do( x := 1 )
Io> slotSummary ==> Object_0x30c590: Lobby = Object_0x30c590 Protos = Object_0x30c880 exit = method(...) forward = method(...)
self test(1, 2) // performs test(1, 2) on self super(test(1, 2)) // performs test(1, 2) on self proto but with the context of self
hour := Date hour switch(
12, "midday",
0, "midnight",
17, "teatime",
Date hour asString
)
Io> Object uniqueId ==> 3146784 Io> Object uniqueHexId ==> 0x300420