String>>#expandMacros new line macro rationale

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

String>>#expandMacros new line macro rationale

gcotelli
Hi,
yesterday I was playing with this method and found something awkward. 

<n> macro is expanded to CR. I was expecting that expands to the line ending of the platform, or at least to LF. 

Anybody knows if this have some explanation? 

I'm tempted to change the <n> expansion to use OSPlatform  current lineEnding , and add <r> as a valid macro expanding to CR. I think it's more consistent with the general use. 

What do you think? If there's consensus I would create an issue and provide a Slice with the changes and some test cases.

Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: String>>#expandMacros new line macro rationale

stepharo
Hi gabriel
>
> <n> macro is expanded to CR. I was expecting that expands to the line
> ending of the platform, or at least to LF.
>
> Anybody knows if this have some explanation?
>
> I'm tempted to change the <n> expansion to use OSPlatform  current
> lineEnding , and add <r> as a valid macro expanding to CR. I think
> it's more consistent with the general use.

Yes
> What do you think? If there's consensus I would create an issue and
> provide a Slice with the changes and some test cases.
Yes I would love that someone or a group of Pharo lover fix the issues
with the encoding. I remember a discussion a while
ago.
>
> Gabriel


Reply | Threaded
Open this post in threaded view
|

Re: String>>#expandMacros new line macro rationale

gcotelli

On Sat, Oct 24, 2015 at 4:19 AM, stepharo <[hidden email]> wrote:
Hi gabriel

<n> macro is expanded to CR. I was expecting that expands to the line ending of the platform, or at least to LF.

Anybody knows if this have some explanation?

I'm tempted to change the <n> expansion to use OSPlatform  current lineEnding , and add <r> as a valid macro expanding to CR. I think it's more consistent with the general use.

Yes
What do you think? If there's consensus I would create an issue and provide a Slice with the changes and some test cases.
Yes I would love that someone or a group of Pharo lover fix the issues with the encoding. I remember a discussion a while
ago.

Gabriel



Reply | Threaded
Open this post in threaded view
|

Re: String>>#expandMacros new line macro rationale

Udo Borkowski
As there is a macro for OSPlatform current lineEnding (<n>) and one for CR (<r>) shouldn’t there also be one for LF?

E.g. in the Java String.format method %n is used for OSPlatform current lineEnding, \n for LF and \r for CR to cover all three cases.

Udo


On 24.10.2015, at 22:22, Gabriel Cotelli <[hidden email]> wrote:


On Sat, Oct 24, 2015 at 4:19 AM, stepharo <[hidden email]> wrote:
Hi gabriel

<n> macro is expanded to CR. I was expecting that expands to the line ending of the platform, or at least to LF.

Anybody knows if this have some explanation?

I'm tempted to change the <n> expansion to use OSPlatform  current lineEnding , and add <r> as a valid macro expanding to CR. I think it's more consistent with the general use.

Yes
What do you think? If there's consensus I would create an issue and provide a Slice with the changes and some test cases.
Yes I would love that someone or a group of Pharo lover fix the issues with the encoding. I remember a discussion a while
ago.

Gabriel