PositionnableStream>>isEmpty is wrong

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

PositionnableStream>>isEmpty is wrong

Damien Cassou-3
Hi,

I'm reading the ANSI Smalltalk Standard 1.9.

Here is the description of #isEmpty:
"Returns true if both the set of past and future sequence values of
the receiver are empty. Otherwise returns false"

However:

(ReadStream on: 'gfssfdfds') isEmpty     => true

I think this is a wrong implementation.

What's your opinion ?

--
Damien Cassou

Reply | Threaded
Open this post in threaded view
|

RE: PositionnableStream>>isEmpty is wrong

Ron Teitelbaum
All,

In my opinion that's a bug.  Even reading the comments of the #isEmpty
method

isEmpty
        "Answer whether the receiver's contents has no elements."

        ^position = 0

But try:

(ReadStream on: 'gfssfdfds') contents

Doesn't look empty to me.

More thoughts?

Ron Teitelbaum



> From: Damien Cassou
> Sent: Tuesday, February 27, 2007 6:13 AM
>
> Hi,
>
> I'm reading the ANSI Smalltalk Standard 1.9.
>
> Here is the description of #isEmpty:
> "Returns true if both the set of past and future sequence values of
> the receiver are empty. Otherwise returns false"
>
> However:
>
> (ReadStream on: 'gfssfdfds') isEmpty     => true
>
> I think this is a wrong implementation.
>
> What's your opinion ?
>
> --
> Damien Cassou
>



Reply | Threaded
Open this post in threaded view
|

Re: PositionnableStream>>isEmpty is wrong

Damien Cassou-3
I have implemented the fix (very simple), 1 test for ReadStream,
WriteStream and ReadWriteStream. I will open a new bug on mantis and
commit the changeset.

Correction:

isEmpty
  "Answer whether the receiver's contents has no elements."

  "Returns true if both the set of past and future sequence values of
the receiver are empty. Otherwise returns false"

  ^ self atEnd and: [position = 0]

Comments ?

--
Damien Cassou

Reply | Threaded
Open this post in threaded view
|

Re: PositionnableStream>>isEmpty is wrong

Damien Cassou-3
Bug was already reported and fixed: http://bugs.impara.de/view.php?id=2273

But the fix is still not in the image.

2007/2/27, Damien Cassou <[hidden email]>:

> I have implemented the fix (very simple), 1 test for ReadStream,
> WriteStream and ReadWriteStream. I will open a new bug on mantis and
> commit the changeset.
>
> Correction:
>
> isEmpty
>   "Answer whether the receiver's contents has no elements."
>
>   "Returns true if both the set of past and future sequence values of
> the receiver are empty. Otherwise returns false"
>
>   ^ self atEnd and: [position = 0]
>
> Comments ?
>
> --
> Damien Cassou
>


--
Damien Cassou

Reply | Threaded
Open this post in threaded view
|

RE: PositionnableStream>>isEmpty is wrong

Ron Teitelbaum
In reply to this post by Damien Cassou-3
+1

I looked at the hierarchy to make sure that buffered streams would not be
affected but I found that the places that this would be a problem were not
subclasses of PositionableStream.  Like SocketStream and SharedQueue ...

(makes sense since position = 0 would have been wrong anyway)

Ron Teitelbaum

> From: Damien Cassou
> Sent: Tuesday, February 27, 2007 10:19 AM
>
> I have implemented the fix (very simple), 1 test for ReadStream,
> WriteStream and ReadWriteStream. I will open a new bug on mantis and
> commit the changeset.
>
> Correction:
>
> isEmpty
>   "Answer whether the receiver's contents has no elements."
>
>   "Returns true if both the set of past and future sequence values of
> the receiver are empty. Otherwise returns false"
>
>   ^ self atEnd and: [position = 0]
>
> Comments ?
>
> --
> Damien Cassou



Reply | Threaded
Open this post in threaded view
|

Re: PositionnableStream>>isEmpty is wrong

Ralph Johnson
In reply to this post by Damien Cassou-3
On 2/27/07, Damien Cassou <[hidden email]> wrote:
> Bug was already reported and fixed: http://bugs.impara.de/view.php?id=2273
>
> But the fix is still not in the image.

There are lots of fixes in Mantis that are not in the image.  Just
going to old issues and posting a note that says "This works in 3.9
and it ought to go into 3.10" will help a lot, because it will 1) push
it to the top of the stack and 2) show that people other than the
author want it.

-Ralph Johnson

Reply | Threaded
Open this post in threaded view
|

Re: PositionnableStream>>isEmpty is wrong

Damien Cassou-3
2007/2/27, Ralph Johnson <[hidden email]>:
> On 2/27/07, Damien Cassou <[hidden email]> wrote:
> There are lots of fixes in Mantis that are not in the image.  Just
> going to old issues and posting a note that says "This works in 3.9
> and it ought to go into 3.10" will help a lot, because it will 1) push
> it to the top of the stack and 2) show that people other than the
> author want it.

Are you going to add my work to 3.10 ?

--
Damien Cassou

Reply | Threaded
Open this post in threaded view
|

Re: PositionnableStream>>isEmpty is wrong

Ralph Johnson
On 2/27/07, Damien Cassou <[hidden email]> wrote:
> Are you going to add my work to 3.10 ?

I'm expecting to add work from many people to 3.10.  Bug fixes are
especially valuable.

I haven't looked at what you have done so far.  So, these are just
general comments that apply to everybody.

We want "fixes" that don't break something else.  In general, we are
going to add things after they've been used and approved by other
people.  So, the more people use your work, the more likely it is to
go in the next release.  I do not consider myself the supreme arbiter
of the future of Squeak, and so want to do things that have general
support.

-Ralph

Reply | Threaded
Open this post in threaded view
|

Re: PositionnableStream>>isEmpty is wrong

Damien Cassou-3
2007/2/27, Ralph Johnson <[hidden email]>:

> On 2/27/07, Damien Cassou <[hidden email]> wrote:
> > Are you going to add my work to 3.10 ?
>
> I'm expecting to add work from many people to 3.10.  Bug fixes are
> especially valuable.
>
> I haven't looked at what you have done so far.  So, these are just
> general comments that apply to everybody.
>
> We want "fixes" that don't break something else.  In general, we are
> going to add things after they've been used and approved by other
> people.  So, the more people use your work, the more likely it is to
> go in the next release.  I do not consider myself the supreme arbiter
> of the future of Squeak, and so want to do things that have general
> support.

In fact, in this repository, there is 1 fix, 2 or 3 added methods, and
maybe 30 tests. I can remove the fix and the added methods to keep
only the tests. So that, you don't have to think about when merging:
only new methods in test classes.

This can be a solution regarding Keith other message about process.
When I have a fix or some methods to add, I can use mantis and Keith
wiki.

What do you think ?

--
Damien Cassou

Reply | Threaded
Open this post in threaded view
|

Re: PositionnableStream>>isEmpty is wrong

keith1y
Damien,

why don't you join us on the V3dot10 mailing list

Keith

               
___________________________________________________________
Try the all-new Yahoo! Mail. "The New Version is radically easier to use" � The Wall Street Journal
http://uk.docs.yahoo.com/nowyoucan.html

Reply | Threaded
Open this post in threaded view
|

Re: PositionnableStream>>isEmpty is wrong

Damien Cassou-3
I am already on the list :-)

2007/2/27, Keith Hodges <[hidden email]>:

> Damien,
>
> why don't you join us on the V3dot10 mailing list
>
> Keith
>
>
> ___________________________________________________________
> Try the all-new Yahoo! Mail. "The New Version is radically easier to use" – The Wall Street Journal
> http://uk.docs.yahoo.com/nowyoucan.html
>
>

--
Damien Cassou


Reply | Threaded
Open this post in threaded view
|

Re: PositionnableStream>>isEmpty is wrong

stephane ducasse
In reply to this post by Ralph Johnson
Hi ralph

you have a lot of fix to harvest that are there and are good. I gave  
a list already.
Like font caching, Monticello improvement from impara, speed  
improvement from marcus,
compiler fixes from marcus, and lot more. May be you should let the  
people see what you
are working on or publishing regularly the fixes that you harvested.  
So far nobody can even
try 3.10 alpha since it is not available.

I would suggest that you do the same as what I did before: From time  
to time, make a call to
know what you forgot and if people can point out the fix/enh that may  
have slipped.

Of course this is better is fix do not break. But sometimes to really  
fix something you
have to break something that turns around it.

Stef

On 27 févr. 07, at 21:53, Ralph Johnson wrote:

> On 2/27/07, Damien Cassou <[hidden email]> wrote:
>> Are you going to add my work to 3.10 ?
>
> I'm expecting to add work from many people to 3.10.  Bug fixes are
> especially valuable.
>
> I haven't looked at what you have done so far.  So, these are just
> general comments that apply to everybody.
>
> We want "fixes" that don't break something else.  In general, we are
> going to add things after they've been used and approved by other
> people.  So, the more people use your work, the more likely it is to
> go in the next release.  I do not consider myself the supreme arbiter
> of the future of Squeak, and so want to do things that have general
> support.
>
> -Ralph
>
>


Reply | Threaded
Open this post in threaded view
|

Re: PositionnableStream>>isEmpty is wrong

Ralph Johnson
> I would suggest that you do the same as what I did before: From time
> to time, make a call to
> know what you forgot and if people can point out the fix/enh that may
> have slipped.

Yes, I was planning on doing that as soon as we were ready.
Unfortunately, we are not ready yet.  I only responded like that
because he asked.

> Of course this is better is fix do not break. But sometimes to really
> fix something you
> have to break something that turns around it.

Yes, though I want to be sure we can tell when we break things, so we
only do it on purpose.

-Ralph