New object (asynchronous constructor)
(anewobject [instructions] expr1 expr2 ...)
(anewobject function expr1 expr2 ...)
(anewo [instructions] expr1 expr2 ...)
(anewo function expr1 expr2 ...)
Creates new object. A list of instructions or a function passed as an argument is used as
constructor of the new object. The constructor is executed in parallel to subsequent instructions of the turtle/object
anewobject instruction. The constructor's arguments can be
passed as optional expressions.
Object in POOL is a simplified version of a turtle. Objects do not have graphics representation and do not
handle events related to graphics (e.g. mouse clicks). Objects use less memory, they are created faster and
also execute their tasks faster than turtles.
"t := (newo)
print parent @ :t
print who @ :t
"t := newo [
"x := 10
print :x @ :t
Note: the message "first" may appear before "o1". The constructor is executed in parallel to
instructions of the turtle
to model :x
let "variable :x
"t := (anewo $model 5)
"y := fn @ :t
Version 1: the message "first" appears always on top - turtle
is not waiting for the constructor.
Version 2: the message "first 25" appears after "model1" - access to the
written in variable
:y makes the turtle
is waiting until the constructor is finished and the function is completed.
Turtle - object
Synchronization of multiple objects
Table of Content