Auto-promotion of Integer to BigInt

Andrew Whitworth wknight8111 at
Tue Nov 10 18:18:23 UTC 2009

If I had my druthers, I would disable autopromotion of Integer to
BigInt. I agree that it's easy enough to flag on overflow and to
manually promote to BigInt if necessary. I don't suspect many people
will agree with this.

--Andrew Whitworth

On Tue, Nov 10, 2009 at 1:11 PM, Martin Kealey <martin at> wrote:
> 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