Large integers, ** and Int

Aaron Sherman ajs at ajs.com
Fri Aug 13 22:28:33 UTC 2010


Hey all... I wasn't ignoring Jonathan's email, I just wanted to get to a
state where I had more to say. So... to try to explain what I'm doing and
the woes I'm running into, I should start at the start:

>From Rakudo, I'm trying to submit this PIR to Parrot:

 .local pmc value
 $P0 = loadlib 'BigInt'
 value = find_lex "$value"
 $I0 = value
 %r = new ['BigInt']
 %r = $I0

That %r is the PMC that Rakudo reserves for return value from the PIR block.

Some questions. First off, I'm getting this error:

set_integer_native() not implemented in class 'BigInt'

That seems absurd, and I'm sure I must just be misunderstanding something.
Am I doing the assignment to %r (Rakudo's return value pmc placeholder,
I believe) wrong? I get the same error if I define my own PMC for this, BTW.

Second, my real goal is to figure out how to encapsulate a BigInt within a
Perl class and then provide overloading for all of the typical Perl
operations (arithmetic, conversion to Str, etc.). Is passing back a raw
BigInt and then handing that around inside a an attribute the right way to
do that, or is there some container I'm supposed to use for such purposes
(preferably in any HLL)?

Also, can I get access to all of the rest of what GMP is capable of from a
BigInt? There's a lot of really cool stuff I'd like to export as methods on
my BigInt class.

Once I know these things, I can get back up to the level of dealing with
things like I was describing in my original mail to perl6-compiler.

On Wed, Aug 11, 2010 at 2:07 PM, Jonathan Leto <jaleto at gmail.com> wrote:

> Howdy,
>
> > Is this an interim limitation, or something that's intended as a
> long-term
> > implementation for Rakudo? Parrot does provide a BigInt now, but in
> trying
> > to use it, I discovered that it has some really strange limitations (then
> > again, I don't know PIR very well, so perhaps it was my fault?) For
> example
> > I don't seem to be able to invoke modulus on a PMC that holds a BigInt.
>
> I am reasonably sure that the modulus of a BigInt should work, could you
> provide some example code of what you were doing?
>
> I've cc'ed parrot-dev on this, since this is not really a p6c topic.
>
> If you attach the output of "parrot_config --dump" that should give us
> the necessary details
> to debug what is going on.
>
> Duke
>
>
>
> --
> Jonathan "Duke" Leto
> jonathan at leto.net
> http://leto.net
>



-- 
Aaron Sherman
Email or GTalk: ajs at ajs.com
http://www.ajs.com/~ajs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.parrot.org/pipermail/parrot-dev/attachments/20100813/d0c0ed1a/attachment.html>


More information about the parrot-dev mailing list