CrLfFileStream class>>new?!

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

CrLfFileStream class>>new?!

Adrian Lienhard
I was just puzzled why "CrLfFileStream defaultToLF" does not work until I figured that CrLfFileStream new returns an instance of a different class:

CrLfFileStream class>>new
        ^ (MultiByteFileStream new) wantsLineEndConversion: true; yourself.


Does somebody know what the point is? I really sometimes wonder why good coders write such code, and not even care to add a comment...

Cheers,
Adrian
___________________
http://www.adrian-lienhard.ch/


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: CrLfFileStream class>>new?!

Henrik Sperre Johansen
Den 09.03.2010 14:38, skrev Adrian Lienhard:

> I was just puzzled why "CrLfFileStream defaultToLF" does not work until I figured that CrLfFileStream new returns an instance of a different class:
>
> CrLfFileStream class>>new
> ^ (MultiByteFileStream new) wantsLineEndConversion: true; yourself.
>
>
> Does somebody know what the point is? I really sometimes wonder why good coders write such code, and not even care to add a comment...
>
> Cheers,
> Adrian
> ___________________
> http://www.adrian-lienhard.ch/
>  
CrLfFileStream does not handle any encodings other than latin1.

My guess is:
-  MultiByteFileStream probably didn't exist when it was created.
- Using a MultiByteFileStream with no encoding, but a lineEndConvention
is now the preferred method, but CrLfFileStream was kept for
backwards-compatability.

Cheers,
Henry

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: CrLfFileStream class>>new?!

Stéphane Ducasse
It would be good to add that to the method and class comment.
Henrik?

Stef

On Mar 9, 2010, at 3:11 PM, Henrik Johansen wrote:

> Den 09.03.2010 14:38, skrev Adrian Lienhard:
>> I was just puzzled why "CrLfFileStream defaultToLF" does not work until I figured that CrLfFileStream new returns an instance of a different class:
>>
>> CrLfFileStream class>>new
>> ^ (MultiByteFileStream new) wantsLineEndConversion: true; yourself.
>>
>>
>> Does somebody know what the point is? I really sometimes wonder why good coders write such code, and not even care to add a comment...
>>
>> Cheers,
>> Adrian
>> ___________________
>> http://www.adrian-lienhard.ch/
>>
> CrLfFileStream does not handle any encodings other than latin1.
>
> My guess is:
> -  MultiByteFileStream probably didn't exist when it was created.
> - Using a MultiByteFileStream with no encoding, but a lineEndConvention
> is now the preferred method, but CrLfFileStream was kept for
> backwards-compatability.
>
> Cheers,
> Henry
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: CrLfFileStream class>>new?!

Henrik Sperre Johansen
  On 09.03.2010 21:48, Stéphane Ducasse wrote:
> It would be good to add that to the method and class comment.
> Henrik?
>
> Stef
Slice-CrLfFileStreamDeprecation in Inbox.

Adds an explanation to class comment and in new method, reroutes the
default-lineEnd methods, and deprecates basicNew just in case.

Cheers,
Henry

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: CrLfFileStream class>>new?!

Stéphane Ducasse
coooool !
I like to be in this community.

Stef


On Mar 10, 2010, at 1:06 AM, Henrik Sperre Johansen wrote:

> On 09.03.2010 21:48, Stéphane Ducasse wrote:
>> It would be good to add that to the method and class comment.
>> Henrik?
>>
>> Stef
> Slice-CrLfFileStreamDeprecation in Inbox.
>
> Adds an explanation to class comment and in new method, reroutes the default-lineEnd methods, and deprecates basicNew just in case.
>
> Cheers,
> Henry
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: CrLfFileStream class>>new?!

Adrian Lienhard
In reply to this post by Henrik Sperre Johansen
Thanks, Henrik!

I created issue http://code.google.com/p/pharo/issues/detail?id=2128 so it doesn't get lost.

Cheers,
Adrian

On Mar 10, 2010, at 01:06 , Henrik Sperre Johansen wrote:

> On 09.03.2010 21:48, Stéphane Ducasse wrote:
>> It would be good to add that to the method and class comment.
>> Henrik?
>>
>> Stef
> Slice-CrLfFileStreamDeprecation in Inbox.
>
> Adds an explanation to class comment and in new method, reroutes the default-lineEnd methods, and deprecates basicNew just in case.
>
> Cheers,
> Henry
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project