Eliot Miranda uploaded a new version of VersionNumber to project The Trunk: http://source.squeak.org/trunk/VersionNumber-eem.5.mcz
==================== Summary ====================
Name: VersionNumber-eem.5 Author: eem Time: 5 November 2022, 1:36:25.499057 pm UUID: 8883b385-6d1b-4659-b488-c677c700707a Ancestors: VersionNumber-cmm.4
Fix VersionNumber>>< so that version numbers of different lengths can be compared. e.g. 1.8 is clearly less than 1.7.4. At the same time fix the comparison so that it terminates as soon as a difference is found.
=============== Diff against VersionNumber-cmm.4 ===============
Item was changed: ----- Method: VersionNumber>>< (in category 'comparing') ----- < another + "Answer whether the receiver is less than the argument, another VersionNumber." - "Answer whether the receiver is less than the argument."
+ | tmp thisSize thatSize this that | - | tmp | - (self inSameBranchAs: another) ifFalse: - [^self error: 'Receiver and argument in different branches']. - tmp := another numbers. + thisSize := numbers size. + thatSize := tmp size. + 1 to: (thisSize min: thatSize) do: + [:i| + (this := numbers at: i) = (that := tmp at: i) ifFalse: + [^this < that]]. + ^thisSize < thatSize! - (tmp size = numbers size) ifTrue: - [1 to: numbers size do: - [ :in | (numbers at: in) < (tmp at: in) ifTrue: [^true]]. - ^false]. - - ^numbers size < tmp size - !
e.g. 1.8 is clearly less than 1.7.4
Eh, no it is not? If less means older here ...
Best, Marcel Am 05.11.2022 21:36:40 schrieb commits@source.squeak.org commits@source.squeak.org: Eliot Miranda uploaded a new version of VersionNumber to project The Trunk: http://source.squeak.org/trunk/VersionNumber-eem.5.mcz
==================== Summary ====================
Name: VersionNumber-eem.5 Author: eem Time: 5 November 2022, 1:36:25.499057 pm UUID: 8883b385-6d1b-4659-b488-c677c700707a Ancestors: VersionNumber-cmm.4
Fix VersionNumber>>
=============== Diff against VersionNumber-cmm.4 ===============
Item was changed: ----- Method: VersionNumber>>
+ "Answer whether the receiver is less than the argument, another VersionNumber." - "Answer whether the receiver is less than the argument."
+ | tmp thisSize thatSize this that | - | tmp | - (self inSameBranchAs: another) ifFalse: - [^self error: 'Receiver and argument in different branches']. - tmp := another numbers. + thisSize := numbers size. + thatSize := tmp size. + 1 to: (thisSize min: thatSize) do: + [:i| + (this := numbers at: i) = (that := tmp at: i) ifFalse: + [^this + ^thisSize - (tmp size = numbers size) ifTrue: - [1 to: numbers size do: - [ :in | (numbers at: in) - ^false]. - - ^numbers size - !
On 7. Nov 2022, at 07:44, Marcel Taeumel marcel.taeumel@hpi.de wrote:
e.g. 1.8 is clearly less than 1.7.4
Eh, no it is not? If less means older here ...
This. 1.8 is exactly the same as 1.8.0, and this sorts definitely _after_ 1.7.4 and is hence, NOT less.
Best regards -Tobias
Best, Marcel
Am 05.11.2022 21:36:40 schrieb commits@source.squeak.org commits@source.squeak.org:
Eliot Miranda uploaded a new version of VersionNumber to project The Trunk: http://source.squeak.org/trunk/VersionNumber-eem.5.mcz
==================== Summary ====================
Name: VersionNumber-eem.5 Author: eem Time: 5 November 2022, 1:36:25.499057 pm UUID: 8883b385-6d1b-4659-b488-c677c700707a Ancestors: VersionNumber-cmm.4
Fix VersionNumber>>< so that version numbers of different lengths can be compared. e.g. 1.8 is clearly less than 1.7.4. At the same time fix the comparison so that it terminates as soon as a difference is found.
=============== Diff against VersionNumber-cmm.4 ===============
Item was changed: ----- Method: VersionNumber>>< (in category 'comparing') ----- < another
- "Answer whether the receiver is less than the argument, another VersionNumber."
- "Answer whether the receiver is less than the argument."
- | tmp thisSize thatSize this that |
- | tmp |
- (self inSameBranchAs: another) ifFalse:
- [^self error: 'Receiver and argument in different branches'].
tmp := another numbers.
- thisSize := numbers size.
- thatSize := tmp size.
- 1 to: (thisSize min: thatSize) do:
- [:i|
- (this := numbers at: i) = (that := tmp at: i) ifFalse:
- [^this < that]].
- ^thisSize < thatSize!
- (tmp size = numbers size) ifTrue:
- [1 to: numbers size do:
- [ :in | (numbers at: in) < (tmp at: in) ifTrue: [^true]].
- ^false].
- ^numbers size < tmp size
- !
If I understand the code correctly it will do the following:
1.8 < 1.8.0 "true" 1.8.0 < 1.8 "false" 1.7.4 < 1.8 "true" 1.8 < 1.7.4 "false" 1.7.4 < 1.8.0 "true" 1.8.0 < 1.7.4 "false"
So concerning 1.8 vs. 1.7.4 the commit message is wrong (typo?), not the implementation. For 1.8 vs 1.8.0 your mileage may vary... but I think the new implementation is consistent with the old one in that case. One might add another line to check whether the rest of the other numbers are all 0.
I do not have an image ready on this machine and cannot look into #inSameBranchAs: now. If < previously signalled the error in the 1.8 < 1.7.4 case, this would be a breaking change, depending on how applications rely on it. At work I have software where 1.7 could have been delivered later than 2.0 and may already have features that 2.0 does not have yet (which 2.1 may get and 3.0 will get). While this is not Squeak software, so practically not relevant here, it shows that the change can be debated theoretically.
Are there test cases for this already? If yes, a test case should be added or one updated for the particular problem that the new commit tries to solve.
Am Mo., 7. Nov. 2022 um 10:21 Uhr schrieb Tobias Pape Das.Linux@gmx.de:
On 7. Nov 2022, at 07:44, Marcel Taeumel marcel.taeumel@hpi.de wrote:
e.g. 1.8 is clearly less than 1.7.4
Eh, no it is not? If less means older here ...
This. 1.8 is exactly the same as 1.8.0, and this sorts definitely _after_ 1.7.4 and is hence, NOT less.
Best regards -Tobias
Best, Marcel
Am 05.11.2022 21:36:40 schrieb commits@source.squeak.org <
commits@source.squeak.org>:
Eliot Miranda uploaded a new version of VersionNumber to project The
Trunk:
http://source.squeak.org/trunk/VersionNumber-eem.5.mcz
==================== Summary ====================
Name: VersionNumber-eem.5 Author: eem Time: 5 November 2022, 1:36:25.499057 pm UUID: 8883b385-6d1b-4659-b488-c677c700707a Ancestors: VersionNumber-cmm.4
Fix VersionNumber>>< so that version numbers of different lengths can
be compared. e.g. 1.8 is clearly less than 1.7.4. At the same time fix the comparison so that it terminates as soon as a difference is found.
=============== Diff against VersionNumber-cmm.4 ===============
Item was changed: ----- Method: VersionNumber>>< (in category 'comparing') ----- < another
- "Answer whether the receiver is less than the argument, another
VersionNumber."
- "Answer whether the receiver is less than the argument."
- | tmp thisSize thatSize this that |
- | tmp |
- (self inSameBranchAs: another) ifFalse:
- [^self error: 'Receiver and argument in different branches'].
tmp := another numbers.
- thisSize := numbers size.
- thatSize := tmp size.
- 1 to: (thisSize min: thatSize) do:
- [:i|
- (this := numbers at: i) = (that := tmp at: i) ifFalse:
- [^this < that]].
- ^thisSize < thatSize!
- (tmp size = numbers size) ifTrue:
- [1 to: numbers size do:
- [ :in | (numbers at: in) < (tmp at: in) ifTrue: [^true]].
- ^false].
- ^numbers size < tmp size
- !
Hi
On 7. Nov 2022, at 11:29, Jakob Reschke jakres+squeak@gmail.com wrote:
If I understand the code correctly it will do the following:
1.8 < 1.8.0 "true" 1.8.0 < 1.8 "false" 1.7.4 < 1.8 "true" 1.8 < 1.7.4 "false" 1.7.4 < 1.8.0 "true" 1.8.0 < 1.7.4 "false"
So concerning 1.8 vs. 1.7.4 the commit message is wrong (typo?), not the implementation. For 1.8 vs 1.8.0 your mileage may vary... but I think the new implementation is consistent with the old one in that case. One might add another line to check whether the rest of the other numbers are all 0.
Meeep. Why total order, then?
from my Point of view, we should have
1.7.4 <= 1.8 <= 1.8.0
I don't think 1.8 < 1.8.0, but that's debatable anyway. However, if we're just concerned with partial order, things ought to be easier:
1.8 <= 1.8.0, but then we can also have 1.8.0 <= 1.8 which would be OK-ish for me.
That said, Eliots implementation is _definitely_ an improvement over the existing one. Let's keep it and then see if we need to augment suff…
Best regards -Tobias
I do not have an image ready on this machine and cannot look into #inSameBranchAs: now. If < previously signalled the error in the 1.8 < 1.7.4 case, this would be a breaking change, depending on how applications rely on it. At work I have software where 1.7 could have been delivered later than 2.0 and may already have features that 2.0 does not have yet (which 2.1 may get and 3.0 will get). While this is not Squeak software, so practically not relevant here, it shows that the change can be debated theoretically.
Are there test cases for this already? If yes, a test case should be added or one updated for the particular problem that the new commit tries to solve.
Am Mo., 7. Nov. 2022 um 10:21 Uhr schrieb Tobias Pape Das.Linux@gmx.de:
On 7. Nov 2022, at 07:44, Marcel Taeumel marcel.taeumel@hpi.de wrote:
e.g. 1.8 is clearly less than 1.7.4
Eh, no it is not? If less means older here ...
This. 1.8 is exactly the same as 1.8.0, and this sorts definitely _after_ 1.7.4 and is hence, NOT less.
Best regards -Tobias
Best, Marcel
Am 05.11.2022 21:36:40 schrieb commits@source.squeak.org commits@source.squeak.org:
Eliot Miranda uploaded a new version of VersionNumber to project The Trunk: http://source.squeak.org/trunk/VersionNumber-eem.5.mcz
==================== Summary ====================
Name: VersionNumber-eem.5 Author: eem Time: 5 November 2022, 1:36:25.499057 pm UUID: 8883b385-6d1b-4659-b488-c677c700707a Ancestors: VersionNumber-cmm.4
Fix VersionNumber>>< so that version numbers of different lengths can be compared. e.g. 1.8 is clearly less than 1.7.4. At the same time fix the comparison so that it terminates as soon as a difference is found.
=============== Diff against VersionNumber-cmm.4 ===============
Item was changed: ----- Method: VersionNumber>>< (in category 'comparing') ----- < another
- "Answer whether the receiver is less than the argument, another VersionNumber."
- "Answer whether the receiver is less than the argument."
- | tmp thisSize thatSize this that |
- | tmp |
- (self inSameBranchAs: another) ifFalse:
- [^self error: 'Receiver and argument in different branches'].
tmp := another numbers.
- thisSize := numbers size.
- thatSize := tmp size.
- 1 to: (thisSize min: thatSize) do:
- [:i|
- (this := numbers at: i) = (that := tmp at: i) ifFalse:
- [^this < that]].
- ^thisSize < thatSize!
- (tmp size = numbers size) ifTrue:
- [1 to: numbers size do:
- [ :in | (numbers at: in) < (tmp at: in) ifTrue: [^true]].
- ^false].
- ^numbers size < tmp size
- !
Addendum
Judging by the current class comment, VersionNumber does not deal with .0 at all. It seems to be just nothing considered... Best regards -Tobias
On 7. Nov 2022, at 12:11, Tobias Pape Das.Linux@gmx.de wrote:
Hi
On 7. Nov 2022, at 11:29, Jakob Reschke jakres+squeak@gmail.com wrote:
If I understand the code correctly it will do the following:
1.8 < 1.8.0 "true" 1.8.0 < 1.8 "false" 1.7.4 < 1.8 "true" 1.8 < 1.7.4 "false" 1.7.4 < 1.8.0 "true" 1.8.0 < 1.7.4 "false"
So concerning 1.8 vs. 1.7.4 the commit message is wrong (typo?), not the implementation. For 1.8 vs 1.8.0 your mileage may vary... but I think the new implementation is consistent with the old one in that case. One might add another line to check whether the rest of the other numbers are all 0.
Meeep. Why total order, then?
from my Point of view, we should have
1.7.4 <= 1.8 <= 1.8.0
I don't think 1.8 < 1.8.0, but that's debatable anyway. However, if we're just concerned with partial order, things ought to be easier:
1.8 <= 1.8.0, but then we can also have 1.8.0 <= 1.8 which would be OK-ish for me.
That said, Eliots implementation is _definitely_ an improvement over the existing one. Let's keep it and then see if we need to augment suff…
Best regards -Tobias
I do not have an image ready on this machine and cannot look into #inSameBranchAs: now. If < previously signalled the error in the 1.8 < 1.7.4 case, this would be a breaking change, depending on how applications rely on it. At work I have software where 1.7 could have been delivered later than 2.0 and may already have features that 2.0 does not have yet (which 2.1 may get and 3.0 will get). While this is not Squeak software, so practically not relevant here, it shows that the change can be debated theoretically.
Are there test cases for this already? If yes, a test case should be added or one updated for the particular problem that the new commit tries to solve.
Am Mo., 7. Nov. 2022 um 10:21 Uhr schrieb Tobias Pape Das.Linux@gmx.de:
On 7. Nov 2022, at 07:44, Marcel Taeumel marcel.taeumel@hpi.de wrote:
e.g. 1.8 is clearly less than 1.7.4
Eh, no it is not? If less means older here ...
This. 1.8 is exactly the same as 1.8.0, and this sorts definitely _after_ 1.7.4 and is hence, NOT less.
Best regards -Tobias
Best, Marcel
Am 05.11.2022 21:36:40 schrieb commits@source.squeak.org commits@source.squeak.org:
Eliot Miranda uploaded a new version of VersionNumber to project The Trunk: http://source.squeak.org/trunk/VersionNumber-eem.5.mcz
==================== Summary ====================
Name: VersionNumber-eem.5 Author: eem Time: 5 November 2022, 1:36:25.499057 pm UUID: 8883b385-6d1b-4659-b488-c677c700707a Ancestors: VersionNumber-cmm.4
Fix VersionNumber>>< so that version numbers of different lengths can be compared. e.g. 1.8 is clearly less than 1.7.4. At the same time fix the comparison so that it terminates as soon as a difference is found.
=============== Diff against VersionNumber-cmm.4 ===============
Item was changed: ----- Method: VersionNumber>>< (in category 'comparing') ----- < another
- "Answer whether the receiver is less than the argument, another VersionNumber."
- "Answer whether the receiver is less than the argument."
- | tmp thisSize thatSize this that |
- | tmp |
- (self inSameBranchAs: another) ifFalse:
- [^self error: 'Receiver and argument in different branches'].
tmp := another numbers.
- thisSize := numbers size.
- thatSize := tmp size.
- 1 to: (thisSize min: thatSize) do:
- [:i|
- (this := numbers at: i) = (that := tmp at: i) ifFalse:
- [^this < that]].
- ^thisSize < thatSize!
- (tmp size = numbers size) ifTrue:
- [1 to: numbers size do:
- [ :in | (numbers at: in) < (tmp at: in) ifTrue: [^true]].
- ^false].
- ^numbers size < tmp size
- !
squeak-dev@lists.squeakfoundation.org