pharo-users@lists.pharo.org

Any question about pharo is welcome

View all threads

PrintString in PBE8

GP
g_patrickb@yahoo.com
Thu, Dec 24, 2020 5:32 PM

I started working through PBE8, and in section 3.13 there is a method:

Counter >> printOn: aStream

super printOn: aStream.

aStream nextPutAll: ' with value: ', count printString.

But it returns two warnings:

[printString] No printString inside printOn

Use cascaded nextPutAll:’s instead of #, in #nextPutAll:

It has the option to automatically resolve the cascaded nextPutAll: which results in:

printOn: aStream

super printOn: aStream.

aStream

nextPutAll: ' with value: ';

nextPutAll: count printString

But it still has the warning about printString.

I started working through PBE8, and in section 3.13 there is a method: `Counter >> printOn: aStream ` `super printOn: aStream. ` `aStream nextPutAll: ' with value: ', count printString.` But it returns two warnings: \[printString\] No printString inside printOn Use cascaded nextPutAll:’s instead of #, in #nextPutAll: It has the option to automatically resolve the cascaded nextPutAll: which results in: `printOn: aStream` ` super printOn: aStream.` ` aStream` ` nextPutAll: ' with value: ';` ` nextPutAll: count printString` But it still has the warning about printString.
RS
Richard Sargent
Thu, Dec 24, 2020 5:58 PM

You should be able to replace
nextPutAll: count printString
with
print: count

On December 24, 2020 9:32:38 AM PST, g_patrickb--- via Pharo-users pharo-users@lists.pharo.org wrote:

I started working through PBE8, and in section 3.13 there is a method:

Counter >> printOn: aStream

super printOn: aStream.

aStream nextPutAll: ' with value: ', count printString.

But it returns two warnings:

[printString] No printString inside printOn

Use cascaded nextPutAll:’s instead of #, in #nextPutAll:

It has the option to automatically resolve the cascaded nextPutAll:
which results in:

printOn: aStream

super printOn: aStream.

aStream

nextPutAll: ' with value: ';

nextPutAll: count printString

But it still has the warning about printString.

You should be able to replace nextPutAll: count printString with print: count On December 24, 2020 9:32:38 AM PST, g_patrickb--- via Pharo-users <pharo-users@lists.pharo.org> wrote: >I started working through PBE8, and in section 3.13 there is a method: > >`Counter >> printOn: aStream ` > >`super printOn: aStream. ` > >`aStream nextPutAll: ' with value: ', count printString.` > >But it returns two warnings: > >\[printString\] No printString inside printOn > >Use cascaded nextPutAll:’s instead of #, in #nextPutAll: > >It has the option to automatically resolve the cascaded nextPutAll: >which results in: > >`printOn: aStream` > >` super printOn: aStream.` > >` aStream` > >` nextPutAll: ' with value: ';` > >` nextPutAll: count printString` > >But it still has the warning about printString.
SD
Stéphane Ducasse
Fri, Dec 25, 2020 3:20 PM

Hi

this warning is just that printOn: is working on a stream

and when we do

printOn: aStream

aStream nextPutAll: x printString

printString creates yeat another stream then ask the contents and passes it to the first one

printOn: aStream

x printOn: aStream

is faster and cleaner in that case.

On 24 Dec 2020, at 18:32, g_patrickb--- via Pharo-users pharo-users@lists.pharo.org wrote:

I started working through PBE8, and in section 3.13 there is a method:

Counter >> printOn: aStream

super printOn: aStream.

aStream nextPutAll: ' with value: ', count printString.

But it returns two warnings:

[printString] No printString inside printOn

Use cascaded nextPutAll:’s instead of #, in #nextPutAll:

It has the option to automatically resolve the cascaded nextPutAll: which results in:

printOn: aStream

super printOn: aStream.

aStream

nextPutAll: ' with value: ';

nextPutAll: count printString

But it still has the warning about printString.


Stéphane Ducasse
http://stephane.ducasse.free.fr / http://www.pharo.org
03 59 35 87 52
Assistant: Aurore Dalle
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley,
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

Hi this warning is just that printOn: is working on a stream and when we do printOn: aStream aStream nextPutAll: x printString printString creates yeat another stream then ask the contents and passes it to the first one printOn: aStream x printOn: aStream is faster and cleaner in that case. > On 24 Dec 2020, at 18:32, g_patrickb--- via Pharo-users <pharo-users@lists.pharo.org> wrote: > > I started working through PBE8, and in section 3.13 there is a method: > > Counter >> printOn: aStream > > super printOn: aStream. > > aStream nextPutAll: ' with value: ', count printString. > > But it returns two warnings: > > [printString] No printString inside printOn > > Use cascaded nextPutAll:’s instead of #, in #nextPutAll: > > > > It has the option to automatically resolve the cascaded nextPutAll: which results in: > > printOn: aStream > > super printOn: aStream. > > aStream > > nextPutAll: ' with value: '; > > nextPutAll: count printString > > > > But it still has the warning about printString. > -------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
SV
Sven Van Caekenberghe
Fri, Dec 25, 2020 3:36 PM

Maybe his question is (also) why the automatic refactoring did it wrong, the rules warned about the wrong use of #printString, suggested a fix, but the solution is still using #printString, hence the same problem.

On 25 Dec 2020, at 16:20, Stéphane Ducasse stephane.ducasse@inria.fr wrote:

Hi

this warning is just that printOn: is working on a stream

and when we do

printOn: aStream

aStream nextPutAll: x printString

printString creates yeat another stream then ask the contents and passes it to the first one

printOn: aStream

x printOn: aStream

is faster and cleaner in that case.

On 24 Dec 2020, at 18:32, g_patrickb--- via Pharo-users pharo-users@lists.pharo.org wrote:

I started working through PBE8, and in section 3.13 there is a method:

Counter >> printOn: aStream

super printOn: aStream.

aStream nextPutAll: ' with value: ', count printString.

But it returns two warnings:

[printString] No printString inside printOn

Use cascaded nextPutAll:’s instead of #, in #nextPutAll:

It has the option to automatically resolve the cascaded nextPutAll: which results in:

printOn: aStream

super printOn: aStream.

aStream

nextPutAll: ' with value: ';

nextPutAll: count printString

But it still has the warning about printString.


Stéphane Ducasse
http://stephane.ducasse.free.fr / http://www.pharo.org
03 59 35 87 52
Assistant: Aurore Dalle
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley,
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

Maybe his question is (also) why the automatic refactoring did it wrong, the rules warned about the wrong use of #printString, suggested a fix, but the solution is still using #printString, hence the same problem. > On 25 Dec 2020, at 16:20, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: > > Hi > > this warning is just that printOn: is working on a stream > > and when we do > > printOn: aStream > > aStream nextPutAll: x printString > > printString creates yeat another stream then ask the contents and passes it to the first one > > > printOn: aStream > > x printOn: aStream > > is faster and cleaner in that case. > > >> On 24 Dec 2020, at 18:32, g_patrickb--- via Pharo-users <pharo-users@lists.pharo.org> wrote: >> >> I started working through PBE8, and in section 3.13 there is a method: >> >> Counter >> printOn: aStream >> >> super printOn: aStream. >> >> aStream nextPutAll: ' with value: ', count printString. >> >> But it returns two warnings: >> >> [printString] No printString inside printOn >> >> Use cascaded nextPutAll:’s instead of #, in #nextPutAll: >> >> >> >> It has the option to automatically resolve the cascaded nextPutAll: which results in: >> >> printOn: aStream >> >> super printOn: aStream. >> >> aStream >> >> nextPutAll: ' with value: '; >> >> nextPutAll: count printString >> >> >> >> But it still has the warning about printString. >> > > -------------------------------------------- > Stéphane Ducasse > http://stephane.ducasse.free.fr / http://www.pharo.org > 03 59 35 87 52 > Assistant: Aurore Dalle > FAX 03 59 57 78 50 > TEL 03 59 35 86 16 > S. Ducasse - Inria > 40, avenue Halley, > Parc Scientifique de la Haute Borne, Bât.A, Park Plaza > Villeneuve d'Ascq 59650 > France >
SD
Stéphane Ducasse
Fri, Dec 25, 2020 9:43 PM

Ah indeed.
So we will have to have a look.

S

On 25 Dec 2020, at 16:36, Sven Van Caekenberghe sven@stfx.eu wrote:

Maybe his question is (also) why the automatic refactoring did it wrong, the rules warned about the wrong use of #printString, suggested a fix, but the solution is still using #printString, hence the same problem.

On 25 Dec 2020, at 16:20, Stéphane Ducasse stephane.ducasse@inria.fr wrote:

Hi

this warning is just that printOn: is working on a stream

and when we do

printOn: aStream

aStream nextPutAll: x printString

printString creates yeat another stream then ask the contents and passes it to the first one

printOn: aStream

x printOn: aStream

is faster and cleaner in that case.

On 24 Dec 2020, at 18:32, g_patrickb--- via Pharo-users pharo-users@lists.pharo.org wrote:

I started working through PBE8, and in section 3.13 there is a method:

Counter >> printOn: aStream

super printOn: aStream.

aStream nextPutAll: ' with value: ', count printString.

But it returns two warnings:

[printString] No printString inside printOn

Use cascaded nextPutAll:’s instead of #, in #nextPutAll:

It has the option to automatically resolve the cascaded nextPutAll: which results in:

printOn: aStream

super printOn: aStream.

aStream

nextPutAll: ' with value: ';

nextPutAll: count printString

But it still has the warning about printString.


Stéphane Ducasse
http://stephane.ducasse.free.fr / http://www.pharo.org
03 59 35 87 52
Assistant: Aurore Dalle
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley,
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France


Stéphane Ducasse
http://stephane.ducasse.free.fr / http://www.pharo.org
03 59 35 87 52
Assistant: Aurore Dalle
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley,
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

Ah indeed. So we will have to have a look. S > On 25 Dec 2020, at 16:36, Sven Van Caekenberghe <sven@stfx.eu> wrote: > > Maybe his question is (also) why the automatic refactoring did it wrong, the rules warned about the wrong use of #printString, suggested a fix, but the solution is still using #printString, hence the same problem. > >> On 25 Dec 2020, at 16:20, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: >> >> Hi >> >> this warning is just that printOn: is working on a stream >> >> and when we do >> >> printOn: aStream >> >> aStream nextPutAll: x printString >> >> printString creates yeat another stream then ask the contents and passes it to the first one >> >> >> printOn: aStream >> >> x printOn: aStream >> >> is faster and cleaner in that case. >> >> >>> On 24 Dec 2020, at 18:32, g_patrickb--- via Pharo-users <pharo-users@lists.pharo.org> wrote: >>> >>> I started working through PBE8, and in section 3.13 there is a method: >>> >>> Counter >> printOn: aStream >>> >>> super printOn: aStream. >>> >>> aStream nextPutAll: ' with value: ', count printString. >>> >>> But it returns two warnings: >>> >>> [printString] No printString inside printOn >>> >>> Use cascaded nextPutAll:’s instead of #, in #nextPutAll: >>> >>> >>> >>> It has the option to automatically resolve the cascaded nextPutAll: which results in: >>> >>> printOn: aStream >>> >>> super printOn: aStream. >>> >>> aStream >>> >>> nextPutAll: ' with value: '; >>> >>> nextPutAll: count printString >>> >>> >>> >>> But it still has the warning about printString. >>> >> >> -------------------------------------------- >> Stéphane Ducasse >> http://stephane.ducasse.free.fr / http://www.pharo.org >> 03 59 35 87 52 >> Assistant: Aurore Dalle >> FAX 03 59 57 78 50 >> TEL 03 59 35 86 16 >> S. Ducasse - Inria >> 40, avenue Halley, >> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza >> Villeneuve d'Ascq 59650 >> France >> -------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
SD
Stéphane Ducasse
Fri, Dec 25, 2020 9:46 PM

On 25 Dec 2020, at 22:43, Stéphane Ducasse stephane.ducasse@inria.fr wrote:

Ah indeed.
So we will have to have a look.

S

On 25 Dec 2020, at 16:36, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

Maybe his question is (also) why the automatic refactoring did it wrong, the rules warned about the wrong use of #printString, suggested a fix, but the solution is still using #printString, hence the same problem.

On 25 Dec 2020, at 16:20, Stéphane Ducasse <stephane.ducasse@inria.fr mailto:stephane.ducasse@inria.fr> wrote:

Hi

this warning is just that printOn: is working on a stream

and when we do

printOn: aStream

aStream nextPutAll: x printString

printString creates yeat another stream then ask the contents and passes it to the first one

printOn: aStream

x printOn: aStream

is faster and cleaner in that case.

On 24 Dec 2020, at 18:32, g_patrickb--- via Pharo-users <pharo-users@lists.pharo.org mailto:pharo-users@lists.pharo.org> wrote:

I started working through PBE8, and in section 3.13 there is a method:

Counter >> printOn: aStream

super printOn: aStream.

aStream nextPutAll: ' with value: ', count printString.

But it returns two warnings:

[printString] No printString inside printOn

Use cascaded nextPutAll:’s instead of #, in #nextPutAll:

It has the option to automatically resolve the cascaded nextPutAll: which results in:

printOn: aStream

super printOn: aStream.

aStream

nextPutAll: ' with value: ';

nextPutAll: count printString

But it still has the warning about printString.


Stéphane Ducasse
http://stephane.ducasse.free.fr http://stephane.ducasse.free.fr/ / http://www.pharo.org http://www.pharo.org/
03 59 35 87 52
Assistant: Aurore Dalle
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley,
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France


Stéphane Ducasse
http://stephane.ducasse.free.fr http://stephane.ducasse.free.fr/ / http://www.pharo.org http://www.pharo.org/
03 59 35 87 52
Assistant: Aurore Dalle
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley,
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France


Stéphane Ducasse
http://stephane.ducasse.free.fr / http://www.pharo.org
03 59 35 87 52
Assistant: Aurore Dalle
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley,
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

I opened a ticket. https://github.com/pharo-project/pharo/issues/8178 > On 25 Dec 2020, at 22:43, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: > > Ah indeed. > So we will have to have a look. > > S > >> On 25 Dec 2020, at 16:36, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >> >> Maybe his question is (also) why the automatic refactoring did it wrong, the rules warned about the wrong use of #printString, suggested a fix, but the solution is still using #printString, hence the same problem. >> >>> On 25 Dec 2020, at 16:20, Stéphane Ducasse <stephane.ducasse@inria.fr <mailto:stephane.ducasse@inria.fr>> wrote: >>> >>> Hi >>> >>> this warning is just that printOn: is working on a stream >>> >>> and when we do >>> >>> printOn: aStream >>> >>> aStream nextPutAll: x printString >>> >>> printString creates yeat another stream then ask the contents and passes it to the first one >>> >>> >>> printOn: aStream >>> >>> x printOn: aStream >>> >>> is faster and cleaner in that case. >>> >>> >>>> On 24 Dec 2020, at 18:32, g_patrickb--- via Pharo-users <pharo-users@lists.pharo.org <mailto:pharo-users@lists.pharo.org>> wrote: >>>> >>>> I started working through PBE8, and in section 3.13 there is a method: >>>> >>>> Counter >> printOn: aStream >>>> >>>> super printOn: aStream. >>>> >>>> aStream nextPutAll: ' with value: ', count printString. >>>> >>>> But it returns two warnings: >>>> >>>> [printString] No printString inside printOn >>>> >>>> Use cascaded nextPutAll:’s instead of #, in #nextPutAll: >>>> >>>> >>>> >>>> It has the option to automatically resolve the cascaded nextPutAll: which results in: >>>> >>>> printOn: aStream >>>> >>>> super printOn: aStream. >>>> >>>> aStream >>>> >>>> nextPutAll: ' with value: '; >>>> >>>> nextPutAll: count printString >>>> >>>> >>>> >>>> But it still has the warning about printString. >>>> >>> >>> -------------------------------------------- >>> Stéphane Ducasse >>> http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> >>> 03 59 35 87 52 >>> Assistant: Aurore Dalle >>> FAX 03 59 57 78 50 >>> TEL 03 59 35 86 16 >>> S. Ducasse - Inria >>> 40, avenue Halley, >>> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza >>> Villeneuve d'Ascq 59650 >>> France >>> > > -------------------------------------------- > Stéphane Ducasse > http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> > 03 59 35 87 52 > Assistant: Aurore Dalle > FAX 03 59 57 78 50 > TEL 03 59 35 86 16 > S. Ducasse - Inria > 40, avenue Halley, > Parc Scientifique de la Haute Borne, Bât.A, Park Plaza > Villeneuve d'Ascq 59650 > France > -------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
SP
Sean P. DeNigris
Sat, Dec 26, 2020 7:41 PM

Sven Van Caekenberghe-2 wrote

Maybe his question is (also) why the automatic refactoring did it wrong,
the rules warned about the wrong use of #printString, suggested a fix, but
the solution is still using #printString, hence the same problem.

I might be reading it wrong, but I thought everything worked as advertised,
and the limitation was that there was no option to automatically fix the
other warning about the printString. The "Use cascaded nextPutAll:’s instead
of #, in #nextPutAll:" transformation did change:

aStream nextPutAll: ' with value: ', count printString.

to:

aStream
nextPutAll: ' with value: ';
nextPutAll: count printString


Cheers,
Sean

Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Sven Van Caekenberghe-2 wrote > Maybe his question is (also) why the automatic refactoring did it wrong, > the rules warned about the wrong use of #printString, suggested a fix, but > the solution is still using #printString, hence the same problem. I might be reading it wrong, but I thought everything worked as advertised, and the limitation was that there was no option to automatically fix the other warning about the printString. The "Use cascaded nextPutAll:’s instead of #, in #nextPutAll:" transformation did change: aStream nextPutAll: ' with value: ', count printString. to: aStream nextPutAll: ' with value: '; nextPutAll: count printString ----- Cheers, Sean -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
SD
Stéphane Ducasse
Sun, Dec 27, 2020 8:59 AM

On 26 Dec 2020, at 20:41, Sean P. DeNigris sean@clipperadams.com wrote:

Sven Van Caekenberghe-2 wrote

Maybe his question is (also) why the automatic refactoring did it wrong,
the rules warned about the wrong use of #printString, suggested a fix, but
the solution is still using #printString, hence the same problem.

I might be reading it wrong, but I thought everything worked as advertised,
and the limitation was that there was no option to automatically fix the
other warning about the printString. The "Use cascaded nextPutAll:’s instead
of #, in #nextPutAll:" transformation did change:

aStream nextPutAll: ' with value: ', count printString.

to:

aStream
nextPutAll: ' with value: ';
nextPutAll: count printString

Yes but with such approach you still create an extra intermediary
stream.

The solution should be

aStream
nextPutAll: ' with value: ‘.
count printOn: aStream

Now this is a bit more tricky to do.


Stéphane Ducasse
http://stephane.ducasse.free.fr / http://www.pharo.org
03 59 35 87 52
Assistant: Aurore Dalle
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley,
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

> On 26 Dec 2020, at 20:41, Sean P. DeNigris <sean@clipperadams.com> wrote: > > Sven Van Caekenberghe-2 wrote >> Maybe his question is (also) why the automatic refactoring did it wrong, >> the rules warned about the wrong use of #printString, suggested a fix, but >> the solution is still using #printString, hence the same problem. > > I might be reading it wrong, but I thought everything worked as advertised, > and the limitation was that there was no option to automatically fix the > other warning about the printString. The "Use cascaded nextPutAll:’s instead > of #, in #nextPutAll:" transformation did change: > > aStream nextPutAll: ' with value: ', count printString. > > to: > > aStream > nextPutAll: ' with value: '; > nextPutAll: count printString > > Yes but with such approach you still create an extra intermediary stream. The solution should be aStream nextPutAll: ' with value: ‘. count printOn: aStream Now this is a bit more tricky to do. > > ----- > Cheers, > Sean > -- > Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html -------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
JM
Julián Maestri
Tue, Dec 29, 2020 6:34 PM

As far as I know:

aStream
nextPutAll: ' with value: ‘;
print: count.

Works with most streams, does not create intermediary streams, and is
readable.

On Sun, 27 Dec 2020 at 05:59, Stéphane Ducasse stephane.ducasse@inria.fr
wrote:

On 26 Dec 2020, at 20:41, Sean P. DeNigris sean@clipperadams.com wrote:

Sven Van Caekenberghe-2 wrote

Maybe his question is (also) why the automatic refactoring did it wrong,
the rules warned about the wrong use of #printString, suggested a fix, but
the solution is still using #printString, hence the same problem.

I might be reading it wrong, but I thought everything worked as advertised,
and the limitation was that there was no option to automatically fix the
other warning about the printString. The "Use cascaded nextPutAll:’s
instead
of #, in #nextPutAll:" transformation did change:

aStream nextPutAll: ' with value: ', count printString.

to:

aStream
nextPutAll: ' with value: ';
nextPutAll: count printString

Yes but with such approach you still create an extra intermediary
stream.

The solution should be

aStream
nextPutAll: ' with value: ‘.
count printOn: aStream

Now this is a bit more tricky to do.


Cheers,
Sean

Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html


Stéphane Ducasse
http://stephane.ducasse.free.fr / http://www.pharo.org
03 59 35 87 52
Assistant: Aurore Dalle
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley,
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

As far as I know: aStream nextPutAll: ' with value: ‘; print: count. Works with most streams, does not create intermediary streams, and is readable. On Sun, 27 Dec 2020 at 05:59, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: > > > On 26 Dec 2020, at 20:41, Sean P. DeNigris <sean@clipperadams.com> wrote: > > Sven Van Caekenberghe-2 wrote > > Maybe his question is (also) why the automatic refactoring did it wrong, > the rules warned about the wrong use of #printString, suggested a fix, but > the solution is still using #printString, hence the same problem. > > > I might be reading it wrong, but I thought everything worked as advertised, > and the limitation was that there was no option to automatically fix the > other warning about the printString. The "Use cascaded nextPutAll:’s > instead > of #, in #nextPutAll:" transformation did change: > > aStream nextPutAll: ' with value: ', count printString. > > to: > > aStream > nextPutAll: ' with value: '; > nextPutAll: count printString > > > > > Yes but with such approach you still create an extra intermediary > stream. > > The solution should be > > > aStream > nextPutAll: ' with value: ‘. > count printOn: aStream > > Now this is a bit more tricky to do. > > > > > > ----- > Cheers, > Sean > -- > Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html > > > -------------------------------------------- > Stéphane Ducasse > http://stephane.ducasse.free.fr / http://www.pharo.org > 03 59 35 87 52 > Assistant: Aurore Dalle > FAX 03 59 57 78 50 > TEL 03 59 35 86 16 > S. Ducasse - Inria > 40, avenue Halley, > Parc Scientifique de la Haute Borne, Bât.A, Park Plaza > Villeneuve d'Ascq 59650 > France > >