#!/usr/local/bin/sim !red_action: writeln "I contain red light!" !red: $$obj object() !obj.name: writeln "I am the color red." !obj.action red_action [obj] !green_action: writeln "I contain green light!" !green: $$obj object() !obj.name: writeln "I am the color green." !obj.action green_action [obj] !blue_action: writeln "I contain blue light!" !blue: $$obj object() !obj.name: writeln "I am the color blue." !obj.action blue_action [obj] !magenta_action: red_action blue_action !magenta: $$obj object() !obj.name: writeln "I am the color magenta." !obj.action magenta_action [obj] !triangle_action: writeln "I have a triangular shape." !magenta_triangle: $$obj object() !obj.name: writeln "I am a magenta triangle." !obj.action: magenta_action triangle_action [obj] !white_action: red_action green_action blue_action !white_triangle: $$obj object() !obj.name: writeln "I am a white triangle." !obj.action: white_action triangle_action [obj] !white_sandwich: $$obj white_triangle() !obj.name: writeln "I am a white sandwich." [obj] $$o ( list red green blue magenta magenta_triangle white_triangle white_sandwich )->first_to_last: [class] !o class() o->name # o.name would work, too, because no members are accessed o->action # o.action would work, too, because no members are accessed writeln write " New object created from last object rather than from a directly specified class name: $n o # "very" complicated in Simplicity ^^ n->name n->action