[Cuis-dev] [FIX] `#(1 2 3) printOn:Transcript` does not work

Gerald Klix cuis.01 at klix.ch
Thu Oct 20 08:26:05 PDT 2022


Hi all, Hi Juan,

Two weeks ago I discovered, that `<some set> printOn: Transcript`
does not work. This is true for every collection, because
Collection#printElementsOn: uses PossitionableStream's protocol.

I am not quite sure, whether there is requirement for printOn:
to restrict itself to Stream's protocol, because the method's
first implementation is more than 22 years old.
Anyways, I consider it nicer and -- more important -- less
surprising that way and `StdIOWriteStream stdout` has the
same issue without any easy workaround.

Please, find attached a fix for that issue.


HTH and Best Regards,

Gerald
-------------- next part --------------
'From Haver 6.0 [latest update: #5496] on 20 October 2022 at 5:12:50 pm'!

!Collection methodsFor: 'printing' stamp: 'KLG 10/20/2022 17:11:30'!
printElementsOn: aStream
	"Print my elements on aStream."

	aStream nextPut: $(.
	self do: [ :element | aStream print: element ] separatedBy: [ aStream space ].
	aStream nextPut: $)! !



More information about the Cuis-dev mailing list