PositionnableStream>>skip: not standard (bug 6353)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

PositionnableStream>>skip: not standard (bug 6353)

Damien Cassou-3
http://bugs.squeak.org/view.php?id=6353

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 ?

Code:
  (ReadStream on: 'test') skip: 6

--
Damien Cassou

Reply | Threaded
Open this post in threaded view
|

Re: PositionnableStream>>skip: not standard (bug 6353)

Klaus D. Witzel
Hi Damien,

on Wed, 21 Mar 2007 13:02:07 +0100, you wrote:
> http://bugs.squeak.org/view.php?id=6353
>
> 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 the number of objects skipped with #skip: identifies the number of  
objects returned with #next: then I'd say that both are in sync.

/Klaus

> If you have other Smalltalk
> implementations at hand, what did they choose ?
>
> Code:
>   (ReadStream on: 'test') skip: 6
>



Reply | Threaded
Open this post in threaded view
|

Re: PositionnableStream>>skip: not standard (bug 6353)

Damien Cassou-3
2007/3/21, Klaus D. Witzel <[hidden email]>:
> If the number of objects skipped with #skip: identifies the number of
> objects returned with #next: then I'd say that both are in sync.

Currently, #skip: raises an error if the parameter makes the stream
goes after the end. So I don't think they are in sync.

(ReadStream on: 'test') next: 6     => 'test'
(ReadStream on: 'test') skip: 6     => ERROR

--
Damien Cassou