2012/12/16 Stéphane Ducasse <[email protected]>: > > On Dec 16, 2012, at 11:44 AM, Nicolas Cellier wrote: > >> 2012/12/16 Stéphane Ducasse <[email protected]>: >>> polymorphically they are a collection with a first and last :) >>> >> >> No. >> >> (5 to: 4) is different than (3 to: 2) because they specify a different >> cursor position. > > Ok that I understand > >> Viewed as collection, they have no first nor last, they're just empty >> >> Nicolas
Currently: (3 to: 2) first -> 3. (3 to: 2) last -> 2. But: (2 to: 4 by: 3) last -> 2 Try to guess the logic behind this... > > I see. But does it make sense to have (thinking aloud)? > (3 to: 2) start -> 3 > (3 to: 2) end -> 2 > probably? Yes, I did that refactoring in Squeak 3.9, but I was sure it would be rejected, too many methods were changed (TextMorph ParagraphEditor & co). See http://bugs.squeak.org/view.php?id=6454 You also know that breaking the classes we use for browsing/debugging is a dangerous sport ;) The simplest thing would be to add a few message to TextLineInterval (first, last, ...) and move it somewhere else in hierarchy, because I don't think it shares that much with Interval. - I guess we don't use much of Collection protocol in TextLineInterval - it spoils first/last uniformity - it can't handle Interval step - ... > > So we should improve that. > If what I said is correct and you confirm it I will open a bug entry > Stef > > I found http://bugs.squeak.org/view.php?id=7002 indicating that most weirdness of Interval were corrected, but I'm quite sure it still has other reported or non reported bugs, except hash. I can still do an infinite loop with to:do: and Float, 2 - Float epsilon to: 2 by: Float epsilon/4 do: [:i | Transcript cr; show: i printString] but Interval>>do: is correct: (well I warned you, some rounding occurs...) (2 - Float epsilon to: 2 by: Float epsilon/4) do: [:i | Transcript cr; show: i printString] For hash, I wonder if it would not be easier to just drop #(2 3) = (2 to: 3) and let it answer false. We have hasSameElementsThan: or isSameSequenceThan: for that purpose. Nicolas > >
