Large integers, ** and Int
Aaron Sherman
ajs at ajs.com
Tue Aug 17 22:48:48 UTC 2010
On Tue, Aug 17, 2010 at 11:51 AM, Moritz Lenz <moritz at faui2k3.org> wrote:
> Aaron Sherman wrote:
> > I did eventually discover that I needed to do this. The problem then
> > became that I can't reliably get exporting an infix:<+> operator from a
> > module to work.
>
> When you try, make sure to declare it as 'our', since Rakudo doesn't
> fully handle lexical exports yet.
>
> # probably also needs type constraints
> our multi sub infix:<+>($a, $b) is export {
> # your code here
> }
>
This is what my signature looks like right now (I've re-named my module
BigTest just to avoid confusion while I develop):
our multi sub infix:<+>(BigTest $lhs, BigTest $rhs) is export {
return BigTest.new(:value(Q:PIR {
...
};
}
When I "use" that file, and try to add:
./perl6 -e 'use BigTest; my BigTest $i .=
new(:value("1000000000000000000000000")); $i = $i + $i; say $i'
I get:
Type check failed for assignment
in '&infix:<=>' at line 1
in main program body at line 1
If I comment out the Numeric method in my class, then that error changes to:
Can't take numeric value for object of type BigTest
in 'Any::Numeric' at line 1339:CORE.setting
in 'infix:<+>' at line 6752:CORE.setting
in main program body at line 1
So it looks like it's just totally unwilling to try to use that inline:<+>
that I've defined, and instead is dead-set on trying to convert my BigTest
to a Numeric in order to match an alternate signature.
--
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/20100817/bcd57b03/attachment.html>
More information about the parrot-dev
mailing list