PositionableStream atEnd

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

PositionableStream atEnd

BrunoBB
Hi All,

After debugging a bug in my application i finally reached "PositionableStream atEnd".

In Dolphin Smalltalk:
stream := ReadStream on: #(1 2 3 4).
stream position: 4.
stream atEnd. "answer <true>" "Dolphin 7"

In GemStone Smalltalk:
stream := ReadStream on: #(1 2 3 4).
stream position: 4.
stream atEnd. "answer <false>" "GemStone 3.3.0"

The GemStone behavior seems to be odd. Because atEnd is [false] then #next is possible. But there is no next.
Which is the login behind this ? :)

regards
bruno
Reply | Threaded
Open this post in threaded view
|

Re: PositionableStream atEnd

GLASS mailing list
Bruno,

The behavior of PositionableStream in GemStone is not compatible with
other Smalltalk implementations, specifically in the way that position:
is handled ...

If you want to be compatible with other Smalltalk implementations, use
the *Portable stream classes:

--------------------
PositionableStreamPortable
  ReadStreamPortable
  WriteStreamPortable
   ReadWriteStreamPortable
    FileStreamPortable
TranscriptStreamPortable

Dale

On 12/26/16 3:09 PM, BrunoBB via Glass wrote:

> Hi All,
>
> After debugging a bug in my application i finally reached
> "PositionableStream atEnd".
>
> In Dolphin Smalltalk:
> stream := ReadStream on: #(1 2 3 4).
> stream position: 4.
> stream atEnd. "answer <true>" "Dolphin 7"
>
> In GemStone Smalltalk:
> stream := ReadStream on: #(1 2 3 4).
> stream position: 4.
> stream atEnd. "answer <false>" "GemStone 3.3.0"
>
> The GemStone behavior seems to be odd. Because atEnd is [false] then #next
> is possible. But there is no next.
> Which is the login behind this ? :)
>
> regards
> bruno
>
>
>
> --
> View this message in context: http://forum.world.st/PositionableStream-atEnd-tp4928156.html
> Sent from the GLASS mailing list archive at Nabble.com.
> _______________________________________________
> Glass mailing list
> [hidden email]
> http://lists.gemtalksystems.com/mailman/listinfo/glass

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: PositionableStream atEnd

BrunoBB
Dale,

Thanks for the answer i now use ReadStreamPortable.

I tried with AnsiReadStream (did not know about xxxPortable) but #atEnd is the same as PositionableStream.

Anyway fixed now (there was a bug in my code also :) with ReadStreamPortable.

regards,
bruno
Reply | Threaded
Open this post in threaded view
|

Re: PositionableStream atEnd

GLASS mailing list
Did you try sending the factory messages #readStream or #writeStream to collections? They should give you Pharo  compatible 0-based streams, and the code will be portable to Squeak and Pharo.

> Sent: Tuesday, December 27, 2016 at 12:54 PM
> From: "BrunoBB via Glass" <[hidden email]>
> To: [hidden email]
> Subject: Re: [Glass] PositionableStream atEnd
>
> Dale,
>
> Thanks for the answer i now use ReadStreamPortable.
>
> I tried with AnsiReadStream (did not know about xxxPortable) but #atEnd is
> the same as PositionableStream.
>
> Anyway fixed now (there was a bug in my code also :) with
> ReadStreamPortable.
>
> regards,
> bruno
>
>
>
> --
> View this message in context: http://forum.world.st/PositionableStream-atEnd-tp4928156p4928195.html
> Sent from the GLASS mailing list archive at Nabble.com.
> _______________________________________________
> Glass mailing list
> [hidden email]
> http://lists.gemtalksystems.com/mailman/listinfo/glass
>
_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass