[Squeakland] Q: Leverage Overlapping Player to Etoys?

Ned Konz ned at squeakland.org
Wed Jan 7 18:48:12 UTC 2004


On Wednesday 07 January 2004 4:19 am, Scott Wallace wrote:
> (1)  The beginnings of just such a thing are already present in the
> Squeakland image.  Look in the 'collections' section of a viewer of
> any playfield-like object, and you'll see the following tile:

Ah, I'd not seen this.

> (2)  With a few small changes, one can arrange matters such that a
> player-reference tile (the kind you tear off via the orange
> halo-handle) will forward any putative message dispatched to it via
> #tellAllContents: on to the tile's referent.  This allows
> player-reference tiles to function as "aliases" for the purpose of
> scripting, as Alan suggests in the excerpt quoted below.
>
> With this change, one can use a Holder (or any other PasteUpMorph) as
> a scripting iterator.

Yes, this makes sense to me.

I'd like to go a bit further with it and let player-valued phrases be used 
(i.e. 'Fred's playerAtCursor'), as well. After the 10th I'll send out a CS 
that lets us deal with player-valued phrases as first-class objects.

> This is just an existence proof.  To become useful, I think we will
> want to extend the etoy vocabulary to allow programmatic creation and
> deletion of the player-reference tiles, etc.

Creation, anyway.

Wouldn't we want to provide some more general way to delete morphs (including 
tiles)? Right now we have "removeAllContents" in Holder; or "doMenuItem: 
#delete". Would it make sense to add a 'delete' verb to some vocabulary that 
could be used for *any* morph? Or was this avoided for a good reason?

Another possibility, BTW, might be to give the TrashCan a Holder-like 
vocabulary.

> CAVEAT:  The #tellAllContents: tile is only available in the
> *Squeakland* image, not in any Squeak.org image at present.

Seems to work in the 3.7a Squeak image if you load 0170textInEToys-sw.cs but I 
haven't tested fully.

Given these ideas, would it make sense to have a new Morph/Player type that 
could be used for the return value from collection-valued slots (like, for 
instance, #incomingConnections when using Connectors, or #submorphs for a 
Morph)? It would be a specialized Holder that would poll the value of its 
expression periodically and update its contents with player tiles. The 
polling could be omitted if it weren't visible.

Modifying its contents would cause the associated collection setter to be 
called (if any). Dropping a non-Tile Morph into it would actually drop a Tile 
and would return the morph to its original position.

-- 
Ned Konz
MetaMagix
Stanwood WA
(360) 629-1091



More information about the Squeak-dev mailing list