Exactly the right feeling :-) --- Philippe Back Dramatic Performance Improvements Mob: +32(0) 478 650 140 | Fax: +32 (0) 70 408 027 Mail:phil@highoctane.be | Web: http://philippeback.eu Blog: http://philippeback.be | Twitter: @philippeback Youtube: http://www.youtube.com/user/philippeback/videos High Octane SPRL rue cour Boisacq 101 | 1301 Bierges | Belgium Pharo Consortium Member - http://consortium.pharo.org/ Featured on the Software Process and Measurement Cast - http://spamcast.libsyn.com Sparx Systems Enterprise Architect and Ability Engineering EADocX Value Added Reseller On Tue, Nov 19, 2013 at 10:51 PM, Nicolas Cellier < nicolas.cellier.aka.nice@gmail.com> wrote:
store: is very old API and its raison d'être is like print: to allow uninterrupted cascades.
someStream nextPut: someChar; print: someObject; nextPutAll: someString; store: someOtherObject.
compared to:
someStream nextPut: someChar. someObject printOn: someStream. someStream nextPutAll: someString. someOtherObject storeOn: someStream.
2013/11/19 Stéphane Ducasse <stephane.ducasse@inria.fr>
I forgot it because the API of Transcript is totally undefined. I have no idea about what store: is about. What I wanted is to have a transcript that can be used to understand concurrent programming.
Stef
On Nov 18, 2013, at 5:26 PM, phil@highoctane.be wrote:
Sure but still, why isn't store: in the Transcript for these? As they are in the other classes
On Mon, Nov 18, 2013 at 5:19 PM, Sven Van Caekenberghe <sven@stfx.eu>wrote:
You could try using #storeString as in
Transcript show: (1 / 2) asScaledDecimal storeString
Sven
On 18 Nov 2013, at 17:09, phil@highoctane.be wrote:
I was playing with ScaledDecimal when doing experiments with numbers in Pharo.
Now, ScaledDecimal says in its comment:
"Note that a ScaledDecimal does not printOn: exactly, however it will storeOn: exactly because the full precision fraction is kept in memory."
This happens to be right when inspecting the expressions.
Now, I tried to do the following:
x := 2 asScaledDecimal. y := 1 asScaledDecimal.
z := (y / x).
z storeOn: Transcript.
And z storeOn: Transcript fails miserably.
This is due to storeOn: doing:
storeOn: aStream "ScaledDecimal sometimes have more digits than they print (potentially an infinity). In this case, do not use printOn: because it would loose some extra digits"
self shouldBePrintedAsLiteral ifTrue: [self printOn: aStream] ifFalse: [aStream nextPut: $(; store: numerator; nextPut: $/; store: denominator; nextPut: $s; store: scale; nextPut: $)]
And store: doesn't exists in the ThreadSafeTranscript which happens to be no stream at all.
Try this out:
x := 2 asScaledDecimal. y := 1 asScaledDecimal.
z := (y / x).
"works" 5.0 storeOn: Transcript. Transcript flush.
"works" (1/2) storeOn: Transcript. Transcript flush.
"fails" z storeOn: Transcript. Transcript flush.
"works" s := (String new: 30). st := s writeStream. z storeOn: st. Transcript show: 'storeOn: ', st contents; cr; show: z.
Kind of annoying to do while explaining to kids.
The ThreadSafe transcript looks like to be subclassed from Object and being no real stream at all.
Why is it so?
Phil