[lively-kernel] Self-style object outliners

Adam Spitz adam.spitz at gmail.com
Tue Mar 9 17:49:34 CET 2010


Jens Lincke wrote:

> I create an object with state and behavior but then I could not figure out
> how to store it. Should I use modules for this?

Yes. I guess I need some documentation about this. :) The Self
tutorial has some information on the module system
(http://selflanguage.org/_static/tutorial/Tutorial/Language/ImportantObjects/Modules.html),
most of which applies to my system too, but here are some quick
instructions:

1. Make a slot called JensObject on the Global object. Make it point
to your object (by dragging its arrow). Then right-click the slot and
choose "be creator." Right-click the slot again and choose "set
module..." to put the slot into a new module.
2. Right-click your object and choose "set module..." to put all of
the object's slots into the same module.
3. Right-click the world and choose "file out module..." to create a .js file.

The idea is that (for now, anyway) the slots in your module need to be
reachable via a path of "creator slots" from the Global object. (The
outliners also use this creator-slot information to display names for
the objects - rather than having an object keep track of its own name,
it can deduce its name by examining the path of creator slots from the
Global object.)

The UI for assigning slots to modules is still a bit clunkier than I'd
like - in Self there's a mechanism for automatically guessing which
module a slot should belong to, so you usually don't need to do it
manually.


Adam


More information about the lively-kernel mailing list