[Glass] Floats problem with SIXX between Pharo and GemStone

Mariano Martinez Peck marianopeck at gmail.com
Wed Feb 26 13:38:16 PST 2014


Hi guys,

When I export SmallDoubles with SIXX in GemStone it generates something
like this:

<sixx.object sixx.id="15" sixx.name="close" sixx.type="SmallDouble"
>1.0000000000000000E-02</sixx.object>

This is because "0.01 asString" -> '1.0000000000000000E-02'

Then I want to load this in Pharo. So first problem is that of course
SmallDouble doesn't exist. So I did:

aSixxShapeChangeStream shapeChangers at: #SmallDouble put: Float.
But then, SIXX use Float >> readFrom: aStream
"Answer a new Float as described on the stream, aStream." ^(super readFrom:
aStream) asFloat


So, of course " Float readFrom: '1.0000000000000000E-02'  "  ->  1.0

So my 0.01 in gemstone become 1.0 in Pharo....

Am I doing something wrong or this is expected? What is the best workaround?

In GemStone I could print the SmallDouble in the XML with a method like

Float >> xmlRepresentation
^ String streamContents:
[:strm | self printOn: strm base: 10]

Is this the correct approach? If true, I guess I should define:

Float >> sixxContentOn: aStream indent: level context: dictionary aStream
nextPutAll: self xmlRepresentation


Thoughts?

Thanks in advance,

-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20140226/5a9bbfcf/attachment.html>


More information about the Glass mailing list