[Glass] Stream >> cr is wrong?

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

[Glass] Stream >> cr is wrong?

Mariano Martinez Peck
Hi guys,

I think I found a bug. Just watching the code, #cr answering LF makes me wonder...

Stream >> cr

"Adds a newline to the output stream."

self nextPut: Character lf.

This piece of code 

String new writeStream 
nextPutAll: 'mariano';
cr;lf;
nextPutAll: 'bug?';
contents

answers

 'mariano

bug?'


While this one:

String new writeStream 
nextPutAll: 'mariano';
nextPut: Character cr;
nextPut: Character lf;
nextPutAll: 'bug?';
contents

Answers:

'mariano
bug?'

So....is this a bug? or is it on purpose? I ask because I have code sending #crlf and in Pharo it is correct but in GemStone I get empty rows below each row ;)

Thanks,



--
Mariano
http://marianopeck.wordpress.com

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

Re: [Glass] Stream >> cr is wrong?

James Foster-9
ANSI 5.9.4.1 specifies that <puttableStream> #’cr’ "Writes an end-of-line sequence to the receiver.” On Linux, the end-of-line sequence is LF, so this is by design (though rather confusing).

On Mar 17, 2014, at 1:57 PM, Mariano Martinez Peck <[hidden email]> wrote:

> Hi guys,
>
> I think I found a bug. Just watching the code, #cr answering LF makes me wonder...
>
> Stream >> cr
>
> "Adds a newline to the output stream."
>
> self nextPut: Character lf.
>
> This piece of code
>
> String new writeStream
> nextPutAll: 'mariano';
> cr;lf;
> nextPutAll: 'bug?';
> contents
>
> answers
>
>  'mariano
>
> bug?'
>
>
> While this one:
>
> String new writeStream
> nextPutAll: 'mariano';
> nextPut: Character cr;
> nextPut: Character lf;
> nextPutAll: 'bug?';
> contents
>
> Answers:
>
> 'mariano
> bug?'
>
> So....is this a bug? or is it on purpose? I ask because I have code sending #crlf and in Pharo it is correct but in GemStone I get empty rows below each row ;)
>
> Thanks,
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.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: [Glass] Stream >> cr is wrong?

Mariano Martinez Peck



On Mon, Mar 17, 2014 at 6:03 PM, James Foster <[hidden email]> wrote:
ANSI 5.9.4.1 specifies that <puttableStream> #’cr’ "Writes an end-of-line sequence to the receiver.” On Linux, the end-of-line sequence is LF, so this is by design (though rather confusing).

mmmm ok, that explains why:

WriteStream >> crlf

self
nextPut: Character cr;
nextPut: Character lf;
yourself.

instead of "self cr; lf"  

ok...so I should not send cr;lf but instead either #crlf or send the nextPut: for each one...  or... use 


 

On Mar 17, 2014, at 1:57 PM, Mariano Martinez Peck <[hidden email]> wrote:

> Hi guys,
>
> I think I found a bug. Just watching the code, #cr answering LF makes me wonder...
>
> Stream >> cr
>
> "Adds a newline to the output stream."
>
> self nextPut: Character lf.
>
> This piece of code
>
> String new writeStream
>       nextPutAll: 'mariano';
>       cr;lf;
>       nextPutAll: 'bug?';
>       contents
>
> answers
>
>  'mariano
>
> bug?'
>
>
> While this one:
>
> String new writeStream
>       nextPutAll: 'mariano';
>       nextPut: Character cr;
>       nextPut: Character lf;
>       nextPutAll: 'bug?';
>       contents
>
> Answers:
>
>        'mariano
> bug?'
>
> So....is this a bug? or is it on purpose? I ask because I have code sending #crlf and in Pharo it is correct but in GemStone I get empty rows below each row ;)
>
> Thanks,
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
> _______________________________________________
> Glass mailing list
> [hidden email]
> http://lists.gemtalksystems.com/mailman/listinfo/glass




--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass