add MMD bug in Integer PMC

Jonathan Leto jaleto at gmail.com
Fri Oct 30 16:14:15 UTC 2009


Howdy,

I think this is wrong and has been a long-standing bug in our code:

The Integer PMC, in the default case of it's add MMD, treats values as
Floats and returns a Float

I would like to treat it as such and write a failing test for it, fix
the bug, and then change the behavior. Is there any reason not to do
this?

Duke

Backstory:

16:37:11 <@whiteknight> VTABLE_set_number_native(INTERP, dest,
SELF.get_integer() + VTABLE_get_number(INTERP, value));
16:37:18 <@whiteknight> so that's the culprit right there
16:37:36 < Austin> Where is that?
16:37:52 <@whiteknight> src/pmc/integer.pmc:357

17:01:07 <@whiteknight> The bug is that the Integer PMC, in the
default case of it's add MMD, treats values as Floats and returns a
Float
17:01:25 <@whiteknight> I think Integer PMC should assume values are
Integer, and should return an Integer in those cases
17:01:31 <@whiteknight> or, set a value as an integer
17:01:41 <@whiteknight> (Float PMC should act on Floats in the same way)

17:03:26 < dukeleto> whiteknight: can you write a failing test for
that vtable bug?
17:03:38 <@whiteknight> Austin just posted two of them
17:03:56 <@whiteknight> the issue is that's it's not currently a
"bug". This is the way it's always worked
17:04:04 <@whiteknight> so we should probably get some agreement that
this is not how we want it to work


-- 

Jonathan Leto
jonathan at leto.net
http://leto.net


More information about the parrot-dev mailing list