idea: slices (a bit long)

Rainer Blome rainer at
Tue Jun 11 15:52:04 UTC 1996

Having this functionality is desirable, absolutely.

Maybe I missed the point, but isn't a slice just a collection that
offers a `do: block' method (you said it), why introduce a new
name?  And if so, wouldn't `selection' be a better one?  `A
selection of objects' sounds more comfortable to me than `A slice
of objects' (What flavor does it have? ;-).

How should this work?  Basically, I see two possibilities.

The first is to require every member of the collection to accept a
`do: block' message, then it is just a matter of forwarding.  This
looks elegant, but it is a potential breach of encapsulation.  If I
were an object, I wouldn't blindly accept and execute any block
that's passed to me.

The other option is to have the collection's `do:' method dissect
the block into a sequence of message expressions and send that
sequence to all members.  No breach of encapsulation here.  To
preserve lexical scoping, though, is not really trivial, at least
not with Self's current code representation facilities.

Another way would be to have the receiver of the block dissect it
and decide about whether or not to accept it depending on the
contents.  This is least elegant, the block dissection chore
would be repeated for each member, so this option doesn't count.

The choice between the first two evaporates when a block actually /is/
a sequence of messages with reified `lexical' bindings (selectors
and contexts).


More information about the Self-interest mailing list