[self-interest] Creating objects from the shell
Jecel Assumpcao Jr.
jecel at merlintec.com
Fri Mar 14 00:02:56 UTC 2014
> I've had some success creating objects from Morphic and using the
> outliner, but I can't seem to create objects using the shell.
> I have tried typing in some of the early examples in the handbook,
> but I only get errors.
> Person = (|name. age | 'test' printLn )
> Example from handbook
> ( | slot1. slot2 | ?here is some code? printLine )
That is an example of a method, not a normal object. A normal object
would look like:
( | slot1. slot2 | )
The second problem is that you are defining a slot at the prompt, but
slots can only be defined inside some object. Before we had a GUI (Self
4) we did stuff like:
lobby _AddSlotsIfAbsent: ( | person = ( | name. age. test = ( 'test'
printLn ) | ) | )
If that works, you can then try this at the prompt:
This example has at least two problems even if it works: the new person
object doesn't have any traits, like clonable or oddball and its data
slots don't have any interesting values, only nil.
More information about the Self-interest