[Pharo-dev] Spaceship?

kilon alios kilon.alios at gmail.com
Mon Nov 4 08:51:39 EST 2013


It looks to me that this would be the source of less readable code, I
prefer the choosing message approach by Kent Beck (Smalltalk Best Practice
Patterns) where intent is clearly stated. Unless there is an advantage I am
missing here. This is an example that less verbose code does not mean
simpler code. Of course this will largely depend on the specifics of the
case used.


On Mon, Nov 4, 2013 at 3:37 PM, Yuriy Tymchuk <yuriy.tymchuk at me.com> wrote:

> Now she someone want’s to have a comparable object he has to use
> TComparable and define < and =.
> With spaceship he has to define only <=>. I’m not sure what’s better. Just
> wanted to hear other peoples opinion
>
> On 04 Nov 2013, at 13:35, Stéphane Ducasse <stephane.ducasse at inria.fr>
> wrote:
>
> > do you have a real use case?
> >
> > Stef
> >
> > On Nov 4, 2013, at 1:32 PM, Yuriy Tymchuk <yuriy.tymchuk at me.com> wrote:
> >
> >> Hi everyone.
> >>
> >> I’m wandering if there was any sort of a discussion about a spaceship
> method used in Ruby.
> >>
> >> The concept is that you should implement a method <=>
> >> that returns something negative if the receiver is smaller then a
> parameter,
> >> positive when the receiver is greater then a parameter,
> >> and 0 if they are equal.
> >>
> >> This way if you are implementing comparable object’s the only method
> you have to redefine is spaceship (<=>).
> >>
> >> Yes, I know that i Pharo you have to only redefine < and =. But maybe
> it would be interesting to use spaceship :)
> >>
> >> What do you think?
> >> Cheers!
> >> Uko
> >
> >
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20131104/71534f50/attachment-0002.html>


More information about the Pharo-dev mailing list