Mantis - Squeak
Viewing Issue Advanced Details
6353 Collections minor always 03-21-07 12:01 03-21-07 14:42
Damien Cassou  
 
normal  
new 3.9  
open  
none    
none  
0006353: PositionnableStream>>skip: not standard
In the standard, #skip: should explicetly not raise an error if #skip:
would go after the end. It is said that "A number of objects equal to
the lesser of amount and the size of the receiver's future sequence
values are removed..."

The current implementation raises an error. Do we choose the current implementation our the standard ? If you have other Smalltalk implementations at hand, what did they choose ?

Attached file is a test for the ANSI behavior.
Code:
  (ReadStream on: 'test') skip: 6
 ReadStreamTest-testSkip.1.cs [^] (531 bytes) 03-21-07 12:01

Notes
(0010458)
nicolas cellier   
03-21-07 14:31   
VW7.3.1 error
Dolphin6 error
STX 5.2.8 error
vast 6.0.3 error
gst 2.2 position: => error; skip: => ANSI
strongtalk 1.1: no error, but position pointer is out of bound and stream is not usable

NOTE: Dolphin6 is aware of non-ANSI-ness (written in comments)

Several solutions:
- keep current behaviour
- switch to ANSI behaviour
- raise a notification rather than an error : while this still give a chance to trap, default handler for unhandled would be to implement ANSI...
- dual selectors skip: skipANSI:, or skip:, skipNonANSI:
- add an ANSI-compatibility package off the kernel image
- make a programmable preference and handle the error according to it
(0010459)
Damien Cassou   
03-21-07 14:42   
> - keep current behaviour
> - switch to ANSI behaviour

I like both solutions. We just need to choose and explain in the comment.

> - dual selectors skip: skipANSI:, or skip:, skipNonANSI:
>- add an ANSI-compatibility package off the kernel image

Don't like that because the aim is not to follow ANSI but be coherent and intelligent. I would prefer a #skip:ifFail:


> - make a programmable preference and handle the error according to it

This is your worst choice :-) I don't want code that behaves differently based on a preference.