[self-interest] Some questions about Self (Transcript, Modules, Browsing Subobjects, Debugging, defaultBehavior)
mail at russell-allen.com
Fri Dec 4 00:28:08 UTC 2009
Hmm. Lets try that again!
Glad to see you're interested in Self! I've put some quick answers below.
Let me know if they're helpful.
On Thu, 03 Dec 2009 09:48:15 -0000, "shanenbe"
<stefan.hanenberg at icb.uni-due.de> wrote:
> Hi all,
> I am relatively new in Self and have a bunch of questions (I am using
> 4.4 alpha2/Linux).
> 1. Transcript
> I wanted to implement something such as Transcript - but I saw that there
> is already such an object (but I cannot open it).
> transcript copy show.
> ends with a "depth not found"-error. Is it maybe a restriction of my
> or does transcript really has this problem?
I'm not sure offhand what the 'transcript' object is supposed to be doing*.
It's not the equivalent of a Smalltalk80 Transcript though. Self usually
uses stdout instead of a separate 'transcript'. It is normally a live
file, so you can do
stdout write: 'Hello'
for example, which should do what you expect it to. The messages 'print'
and 'printLine' print by default to stdout.
* I did some searching. 'Transcript' is part of ui1 (ie the ui before
morphic). Hmm. UI1 is great fun, but probably should be moved to a separate
download rather than putting it in the Clean snapshot.
> 2. Modules
> Is there an easy way to see what elements are in a module? For examples,
> added a module "shChanges" which I open via "modules shChanges". Can I
> somehow what objects exist in this module?
Modules are sets of slots with information on where those slots are placed
in relation to the lobby.
If you open an outliner on "modules shChanges", you will see that it has a
parent "modules init parent"; opening an outliner on that will let you see
what messages modules understand. "slotsInMeAndAllSubparts" might be good
place to start.
This might be a little low level for what you are looking for, though.
> 3. Subobjects of a certain object
> Is there a way to see what objects are subobjects of a given one? For
> example, if I have an outliner for "defaultBehavior". Is there a way to
> a list of all object which use defaultBehavior as parent?
Bring up the orange/brown menu on the outliner, and choose "children".
> 4. Debugging
> Is there a way to evaluate an object which is shown in the debugger. For
> example, if I have a error in a statement such as
> doPrint: myObject doSomething
> and I want to inspect myObject. Does the debugger provide such a thing?
> I evaluate a statement using the context of the debugger?
You should be able to get an outliner on "myObject" by clicking the word
"myObject" in the debugger.
Not sure about evaluating statements in the context of the debugger - do
you mean without changing the existing frames?
You might find this useful if you haven't read it yet:
> 5. Design decision with defaultBehavior
> I am slightly confused about the design decision that not every object
> defaultBehavior as super object. Is this intended in that way or rather
> accident"? The reason why it confuses me is, that i cannot use a new
> created object within a collection (since slots for e.g. comparing
> are not available).
I'll let the designers discuss the design choices :) but as I see it Self
tends to err on the side of allowing developer choice and power rather than
building stuff into the language (eg you can create a class based system on
top of Self if you want, but if you don't want to you don't need to ---
classes aren't built into the language). The Handbook says that "It is
entirely permissible to construct objects that do not inherit from the
lobby, and the Self world contains quite a few such objects."
In practice I don't find naked objects as much of a problem as initially I
would have thought. This could be because:
- I find myself using collections less than in other languages such as
python, and more bespoke objects to hold my data. This could also be
because the outliners at the moment don't give enough support for
collections (something I would like to fix)
- I'm used to making my objects share 'traits oddball' or 'traits clonable'
as appropriate (not just for collections --- objects that don't inherit the
lobby don't understand 'true' or 'false' etc either)
eg (| parent* = traits clonable. mySlot = 20. otherSlot <- true. myMethod =
(| | otherSlot = false ) |)
While I've got you, one unrelated question: How do you start your Self
snapshot/vm? There are a number of ways and I was recently surprised that
someone was doing things in a convoluted way I didn't expect, so I'm trying
to get a feel for how people are using it (especially on Linux, which is a
new platform for us)
More information about the Self-interest