Auto-promotion of Integer to BigInt

Martin Kealey martin at
Tue Nov 10 18:11:56 UTC 2009

I'm looking at the test suite for BigInt, and it includes some tests that
Integer gets promoted to BigInt when the result would be out of range.

I tried adding tests for "neg" and "abs" and they failed, so obviously
there's an implementation issue.

But beyond that, is there a good reason why Integer's behaviour should
differ from int? I mean, if someone wants BigInt behaviour (even for little
numbers) they only have to ask for it. Conversely, how else does one box an

Also autopromotion does nasty things to representational constancy (bad for

So I'd like @parrot_dev's advice: do I go ahead and put in tests for
everything assuming that autopromotion will always happen when needed, or do
we rip out autopromotion entirely? Or perhaps fork Integer into Int (boxed
int) and Integer (small BigInt)?


More information about the parrot-dev mailing list