Hi,
can we have a class-side configuration for STON line ending? Atm if I want to output with LF instead of CR (which is always), then I have to always do this String streamContents: [ :stream | (STON writer on: stream) prettyPrint: true; newLine: String lf; nextPut: data ]. I would be much happier if at least I could do this STON lineEnding: String lf (I could put the above in a StartupScript) And then just use regular STON toStringPretty: data. And I would be even happier if STON class>>lineEnding ^ String lf or STON class>>lineEnding ^ OSPlatform current isWindows ifTrue: [ String crlf ] ifFalse: [ String lf ] (Although always using LF by default might be preferable.) To summarize, it would be great if we could: * switch STON to LF _by default_ * allow users to easily switch to CR/CRLF if they need Thanks, Peter |
Yes it would make much more sense to default to LF EOL (maybe not on Windows) in this century, but that is true for the whole image ...
> On 19 Aug 2016, at 14:49, Peter Uhnak <[hidden email]> wrote: > > Hi, > > can we have a class-side configuration for STON line ending? > > Atm if I want to output with LF instead of CR (which is always), > then I have to always do this > > String streamContents: [ :stream | > (STON writer on: stream) > prettyPrint: true; > newLine: String lf; > nextPut: data > ]. > > I would be much happier if at least I could do this > > STON lineEnding: String lf > > (I could put the above in a StartupScript) > > And then just use regular STON toStringPretty: data. > > > And I would be even happier if > > STON class>>lineEnding > ^ String lf > > or > > STON class>>lineEnding > ^ OSPlatform current isWindows > ifTrue: [ String crlf ] > ifFalse: [ String lf ] > > (Although always using LF by default might be preferable.) > > To summarize, it would be great if we could: > > * switch STON to LF _by default_ > * allow users to easily switch to CR/CRLF if they need > > Thanks, > Peter > |
On Fri, Aug 19, 2016 at 02:55:08PM +0200, Sven Van Caekenberghe wrote:
> Yes it would make much more sense to default to LF EOL (maybe not on Windows) in this century, but that is true for the whole image ... I agree, but this is imho very simple and actionable change and a step forward. Changing whole image is a much bigger issue. Re Windows: we should make a poll among Windows users to see what makes the most sense for them. Peter > > > On 19 Aug 2016, at 14:49, Peter Uhnak <[hidden email]> wrote: > > > > Hi, > > > > can we have a class-side configuration for STON line ending? > > > > Atm if I want to output with LF instead of CR (which is always), > > then I have to always do this > > > > String streamContents: [ :stream | > > (STON writer on: stream) > > prettyPrint: true; > > newLine: String lf; > > nextPut: data > > ]. > > > > I would be much happier if at least I could do this > > > > STON lineEnding: String lf > > > > (I could put the above in a StartupScript) > > > > And then just use regular STON toStringPretty: data. > > > > > > And I would be even happier if > > > > STON class>>lineEnding > > ^ String lf > > > > or > > > > STON class>>lineEnding > > ^ OSPlatform current isWindows > > ifTrue: [ String crlf ] > > ifFalse: [ String lf ] > > > > (Although always using LF by default might be preferable.) > > > > To summarize, it would be great if we could: > > > > * switch STON to LF _by default_ > > * allow users to easily switch to CR/CRLF if they need > > > > Thanks, > > Peter > > > > |
In reply to this post by Sven Van Caekenberghe-2
I got bitten by messy files recently and I have the impression that you
should have in and out line ending settings (because may be you want to see Ston one way and output the other) And for the image I'm afraid by the amount of code it will break but it would be really good. May be migrating to Xtreams first should be the path. Stef Le 19/8/16 à 14:55, Sven Van Caekenberghe a écrit : > Yes it would make much more sense to default to LF EOL (maybe not on Windows) in this century, but that is true for the whole image ... > >> On 19 Aug 2016, at 14:49, Peter Uhnak <[hidden email]> wrote: >> >> Hi, >> >> can we have a class-side configuration for STON line ending? >> >> Atm if I want to output with LF instead of CR (which is always), >> then I have to always do this >> >> String streamContents: [ :stream | >> (STON writer on: stream) >> prettyPrint: true; >> newLine: String lf; >> nextPut: data >> ]. >> >> I would be much happier if at least I could do this >> >> STON lineEnding: String lf >> >> (I could put the above in a StartupScript) >> >> And then just use regular STON toStringPretty: data. >> >> >> And I would be even happier if >> >> STON class>>lineEnding >> ^ String lf >> >> or >> >> STON class>>lineEnding >> ^ OSPlatform current isWindows >> ifTrue: [ String crlf ] >> ifFalse: [ String lf ] >> >> (Although always using LF by default might be preferable.) >> >> To summarize, it would be great if we could: >> >> * switch STON to LF _by default_ >> * allow users to easily switch to CR/CRLF if they need >> >> Thanks, >> Peter >> > > |
On Sat, Aug 20, 2016 at 03:26:41PM +0200, stepharo wrote:
> I got bitten by messy files recently and I have the impression that you > should have > > in and out line ending settings (because may be you want to see Ston one way > and output the other) Unless I am mistaken, line endings for STON itself are not significant, so input line-endings are not that important. And if you have line endings in strings, those are not affected, so nothing (in theory) should break. Or did you mean something else? Peter |
Free forum by Nabble | Edit this page |