( ---------------- zen object orientation -------------- ) [ immovable ]this[ swap do ]done[ ] is object ( --> ) [ ]'[ ] is method ( --> [ ) [ method [ dup share swap put ] ] is localise ( --> [ ) [ method [ release ] ] is delocalise ( --> [ ) ( -------------- example: counter methods -------------- ) ( to create a counter object, use: "[ object 0 ] is 'name' ( [ --> )" ) [ method [ 0 swap replace ] ] is reset-counter ( --> [ ) [ method [ 1 swap tally ] ] is increment-counter ( --> [ ) [ method [ share ] ] is report-counter ( --> [ ) ( -------------------- demonstration ------------------- ) say 'Creating counter object: "mycounter".' cr cr [ object 0 ] is mycounter ( [ --> ) say "Initial value of mycounter: " report-counter mycounter echo cr cr say "Incrementing mycounter three times." cr 3 times [ increment-counter mycounter ] say "Current value of mycounter: " report-counter mycounter echo cr cr say "Localising mycounter." cr cr localise mycounter say " Current value of mycounter: " report-counter mycounter echo cr cr say " Resetting mycounter." cr reset-counter mycounter say " Current value of mycounter: " report-counter mycounter echo cr cr say " Incrementing mycounter six times." cr 6 times [ increment-counter mycounter ] say " Current value of mycounter: " report-counter mycounter echo cr cr say "Delocalising mycounter." cr cr delocalise mycounter say "Current value of mycounter: " report-counter mycounter echo cr cr say "Resetting mycounter." cr reset-counter mycounter say "Current value of mycounter: " report-counter mycounter echo cr cr