idea: slices
Rainer Blome
rainer at physik3.gwdg.de
Wed Jun 12 16:29:34 UTC 1996
Jecel wrote:
> Rainer wrote:
> > How should this work? Basically, I see two possibilities.
But I didn't see the obvious one:
> Why can't it work as normal collections? Pass each
> element of the slice to the block
>
> block value: thisElement
> ...
> I think you are complicating something that is
> almost trivial.
You are right, this is the way to do it in Self.
What I thought of is slightly different, though. The `value:'
argument gives a name to the element, by which it is then referred
to from within the block. I wanted to leave the element implicit,
to let the block be sort of an external method. The block's code
would look like it were in a method of the element, with
encapsulation preserved.
Currently, if I understand correctly, you have to write sth. like
selection do: [|value| value moveBy: distance. ].
I was looking for a way to allow
selection do: [moveBy: distance. ].
For this to work, global behavior would have to include a way to
accept and process such a block (either by a `do:' message or, even
cooler, by directly accepting blocks as messages). Am I missing
something (again)?
Rainer
More information about the Self-interest
mailing list