Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006454 [Squeak] Collections minor always 04-29-07 13:59 05-01-07 20:03
Reporter nicolas cellier View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 3.9
Summary 0006454: [BUG] An empty Interval has a first and a last element. It should not.
Description An empty Interval should complain when asked for first or last element, as would super implementation.
Additional Information
Attached Files  Interval-EmptyFirstLast-Test.1.cs [^] (472 bytes) 04-29-07 14:01
 Interval-EmptyFirstLast-Patch.1.cs [^] (40,478 bytes) 05-01-07 20:03

- Relationships
child of 0007002new  The Mother of all issues involving interval 

- Notes
(0010629 - 382 - 418 - 418 - 418 - 418 - 418)
nicolas cellier
04-29-07 22:14
edited on: 04-29-07 22:53

since first and last are optimization, and correcting them would make this optimization void, rationale is to remove these methods.

However, users of ParagraphEditor selection and maybe some users of subclass TextLineInterval rely on this behaviour and will fail and recursively open debuggers in case of empty selection...

So this should be indicated with a proper comment.

 
(0010643 - 707 - 769 - 769 - 769 - 769 - 769)
black
05-01-07 16:38

These methods are just broken, and should rasie a subscript out of bounds error on first and last, just like any other empty collection.

Intervals play a dual role: as collections and as regions of the number line. We saw this with includes:, which some thought should mean <= start and <= stop, but didn't: includes: means "is it in the collection". The solution here was to add #rangeIncludes: to do the other thing.

So, perhaps we could add rangeStart and rangeStop as methods to do the other behavior, and make the ParagraphEditor and TextLineInterval subclasses use those messages?

Even with this interpretation, the "optimization" for last is wrong: (1 to: -5 by: 5) last evealuates to -9
 
(0010644 - 402 - 456 - 456 - 456 - 456 - 456)
nicolas cellier
05-01-07 20:02
edited on: 05-01-07 20:04

Yes, agree.
I gave it a try yesterday, and that's a lot of senders to be changed...
I implemented start and stop instead of rangeStart and rangeStop.
I browse for senders of selectFrom:to: selectionInterval lines (Yes TextLineInterval has to be changed too).
Sure i have forgotten a lot...
See the .cs to give an idea

Yet, i did not remove selectors first and last to get the image running...

 

- Issue History
Date Modified Username Field Change
04-29-07 13:59 nicolas cellier New Issue
04-29-07 14:01 nicolas cellier File Added: Interval-EmptyFirstLast-Test.1.cs
04-29-07 22:14 nicolas cellier Note Added: 0010629
04-29-07 22:53 nicolas cellier Note Edited: 0010629
04-29-07 22:53 nicolas cellier Note Edited: 0010629
05-01-07 16:38 black Note Added: 0010643
05-01-07 20:02 nicolas cellier Note Added: 0010644
05-01-07 20:03 nicolas cellier File Added: Interval-EmptyFirstLast-Patch.1.cs
05-01-07 20:04 nicolas cellier Note Edited: 0010644
08-21-10 13:10 nicolas cellier Relationship added child of 0007002


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
58 total queries executed.
33 unique queries executed.
Powered by Mantis Bugtracker