could you add a bug entry with the discussion because else this will be lost.

Stef

On 1/8/14 17:58, Natalia Tymchuk wrote:
Thank you.
I don’t need it, because I know what is written in my code, but it can be the problem for users and I think that it will good to fix it.
Best regards,
Natalia

On Aug 1, 2014, at 5:07 PM, Clément Bera <[email protected] <mailto:[email protected]>> wrote:

Hello,

Natalia I don't think this is a known bug (few people use Float and Fraction in Pharo).

The RBParser parse your floating pointers as Fraction and not as Float (I don't know why).

In the debugger the bytecode pc to source code pointer is mapped by printing the AST. In this case, the AST node (RBLiteralNode) for your float holds a Fraction. The code to print a literal node is as follow:

visitLiteralNode: aLiteralNode
aLiteralNode value isLiteral
ifFalse: [  self writeString: '''<an unprintable nonliteral value>''' ]
ifTrue: [ self writeString: aLiteralNode token storeString ]

and isLiteral answers always false for a Fraction.

A temporary patch consists in adding the method

Fraction>>isLiteral
    ^ true

Then you can debug your code.

However, I think a real patch would consists in adding the method isLiteral in Fraction but with correct code to answer true only if the fraction can be a literal. Something similar to Float>>#isLiteral.


2014-08-01 15:40 GMT+02:00 Serge Stinckwich <[email protected] <mailto:[email protected]>>:

    Yes, I see also the same problem.

    I didn't realize until now that : 1-1e-6
    is printed as a fraction (try print-it):
    (999999/1000000)

    A little bit strange, no ?

    On Fri, Aug 1, 2014 at 3:05 PM, Natalia Tymchuk
    <[email protected]
    <mailto:[email protected]>> wrote:
    > Hello.
    >  When I have the following expression
    > {1-1e-6. 1e-6. 0}
    > in the code and then I debug it I get
    > {(1 - '<an unprintable nonliteral value>').
    >         '<an unprintable nonliteral value>'.
    >         0}.
    >
    > Is it a known problem or should I report an issue on debug tracker?
    >
    > Best regards,
    > Natalia
    >



    --
    Serge Stinckwich
    UCBN & UMI UMMISCO 209 (IRD/UPMC)
    Every DSL ends up being Smalltalk
    http://www.doesnotunderstand.org/




Reply via email to