Pipe syntax and the current methods
Bert Freudenberg
bert at freudenbergs.de
Tue Aug 28 00:49:53 UTC 2007
On Aug 27, 2007, at 17:32 , Andrew Tween wrote:
>
> <snip>
>> With the generic pipe object from my change-set in the original
>> thread this gets you both - no need to define new methods:
>>
>> highestNumberedChangeSet
>> "ChangeSorter highestNumberedChangeSet"
>> ^self allChangeSetNames asPipe
>> select:[:aString | aString startsWithDigit];
>> collect:[:aString | aString initialIntegerOrNil];
>> ifNotEmpty:[:list | list max]
>
> Yes. I am coming to the conclusion that there is no need for
> additional syntax; your solution works really well.
> I would suggest, however, that Pipe is made a subclass of
> ProtoObject rather than Object. This will avoid oddities such as...
>
> (1 asPipe + 1; + 1; = 3) evaluates to false
>
> but with Pipe a subclass of ProtoObject, it evaluates to true, as
> expected.
Sure. It just immensely improves debuggability if you start with an
Object subclass first ;) Also, the reasonable use cases would
usually involve only methods that are not in Object. Provided someone
would actually want to play these meta games ;)
- Bert -
More information about the Squeak-dev
mailing list
|