Re-sending my message which went to parrot-dev, and should have gone to
perl6-compiler. Sorry.

On Tue, Aug 17, 2010 at 6:48 PM, Aaron Sherman <a...@ajs.com> wrote:

>
> On Tue, Aug 17, 2010 at 11:51 AM, Moritz Lenz <mor...@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: a...@ajs.com
> http://www.ajs.com/~ajs
>

Reply via email to