New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Interval>>sort: method that raises a "you can not sort an inter… #1922
Added Interval>>sort: method that raises a "you can not sort an inter… #1922
Conversation
Interval >> sort: aBlock [ | ||
"What sorting an Interval means is not clear." | ||
|
||
self error: 'you can not sort an interval' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for the missing capital letter at the beginning of the error message and the dot at the end, this is fine for me. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote it like that to be consistent with the Interval>>at:put: method:
at: anInteger put: anObject
"Storing into an Interval is not allowed."
self error: 'you can not store into an interval'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But sure, why not.
…nd ends with a dot. - Interval>>sort: method moved to sorting protocol so that it is in the same protocol as the sort: method of the superclass
the case on the issue tracker is https://pharo.fogbugz.com/f/cases/22588/Sorting-an-Interval-raises-an-exception |
@MarcusDenker @pavel-krivanek |
…val" error
From fogbuz issue:
Interval new sort raises an "#< was sent to nil" exception
(1 to: 5) sort raises an "you can not store into an interval" exception
The Interval class inherits the default #sort: method of SequenceableCollection, which does not work for intervals. I am not sure the concept of sorting an Interval makes sense in the general case. I suggest implementing Interval>>sort: so that it raises an explicit exception: "you can not sort an interval" akin to what Interval>>at:put: does (it raises "you can not store into an interval"). Unless someone has an idea for what "sorting an Interval" could mean.