Auto-promotion of Integer to BigInt

Martin Kealey martin at kurahaupo.gen.nz
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
int?

Also autopromotion does nasty things to representational constancy (bad for
multithreading).

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)?

-Martin


More information about the parrot-dev mailing list