Pipe syntax and the current methods

Andrew Tween amtween at hotmail.com
Tue Aug 28 00:32:06 UTC 2007


<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.

Cheers,
Andy 





More information about the Squeak-dev mailing list