Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MMD fail for undef/complex interaction. #363

Closed
p6rt opened this issue Oct 19, 2008 · 6 comments
Closed

MMD fail for undef/complex interaction. #363

p6rt opened this issue Oct 19, 2008 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Oct 19, 2008

Migrated from rt.perl.org#59982 (status was 'resolved')

Searchable as RT59982$

@p6rt
Copy link
Author

p6rt commented Oct 19, 2008

From @bacek

Hello.

00​:05 bacek
  rakudo​: my $a; $a = $a + 1i; say $a

00​:05 polyglotbot
  OUTPUT[Multiple Dispatch​: No suitable candidate found for 'add', with
signature 'PPP->P'␤current instr.​: 'infix​:+' pc 1941
(src/gen_builtins.pir​:1368)␤called from Sub '_block11' pc 60
(EVAL_12​:25)␤called from Sub 'parrot;PCT;HLLCompiler;eval' pc 864
(src/PCT/HLLCompiler.pir​:498)␤called from Sub

00​:08 bacek
  rakudo​: my $a; $a = 1i + $a; say $a

00​:08 polyglotbot
  OUTPUT[0+1i␤]

--
Bacek

@p6rt
Copy link
Author

p6rt commented Nov 23, 2008

From @moritz

On Sat Oct 18 17​:15​:30 2008, bacek wrote​:

Hello.

00​:05 bacek
rakudo​: my $a; $a = $a + 1i; say $a

00​:05 polyglotbot
OUTPUT[Multiple Dispatch​: No suitable candidate found for 'add', with
signature 'PPP->P'␤current instr.​: 'infix​:+' pc 1941
(src/gen_builtins.pir​:1368)␤called from Sub '_block11' pc 60
(EVAL_12​:25)␤called from Sub 'parrot;PCT;HLLCompiler;eval' pc 864
(src/PCT/HLLCompiler.pir​:498)␤called from Sub

Added test to the test suite in (pugs) r23061,
t/spec/S03-operators/autovivification.t

Moritz

@p6rt
Copy link
Author

p6rt commented Nov 23, 2008

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Nov 26, 2008

From @jnthn

On Sun Nov 23 10​:33​:24 2008, moritz wrote​:

On Sat Oct 18 17​:15​:30 2008, bacek wrote​:

Hello.

00​:05 bacek
rakudo​: my $a; $a = $a + 1i; say $a

00​:05 polyglotbot
OUTPUT[Multiple Dispatch​: No suitable candidate found for 'add', with
signature 'PPP->P'␤current instr.​: 'infix​:+' pc 1941
(src/gen_builtins.pir​:1368)␤called from Sub '_block11' pc 60
(EVAL_12​:25)␤called from Sub 'parrot;PCT;HLLCompiler;eval' pc 864
(src/PCT/HLLCompiler.pir​:498)␤called from Sub

Added test to the test suite in (pugs) r23061,
t/spec/S03-operators/autovivification.t

Fixed in r33214 and test unfudged.

Note on the fix and what I'm guessing general direction may be on such
things. I did it by implementing .Complex (which I believe should exist
as a method on Any), which is what coerces something to Complex. Types
can override this if they want to coerce in their own special way.

I suspect when we write things such as the infix​:<+> in a Perl 6 prelude
we'll end up writing something like​:

multi method infix​:<+>(Complex $a, $b as Complex) { ... }

Which could coerce that second parameter into being a Complex (note that
the Complex method actually returns a Complex, and doesn't modify the
original value).

I believe the Any method would also be exported...

multi method Complex() is export { ... }

So we'll get a sub form too...

Complex(...)

But trying to introduce a sub form right now causes clashes with the
Complex proto-object in the namespace. Ouch. :-( Anyway, that's a wider
issue and not specific to this ticket, so treating as resolved.

Jonathan

@p6rt
Copy link
Author

p6rt commented Nov 26, 2008

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Nov 26, 2008
@p6rt
Copy link
Author

p6rt commented Nov 26, 2008

From @pmichaud

On Wed, Nov 26, 2008 at 04​:35​:41AM -0800, jnthn@​jnthn.net via RT wrote​:

I believe the Any method would also be exported...

multi method Complex() is export { ... }

So we'll get a sub form too...

Complex(...)

But trying to introduce a sub form right now causes clashes with the
Complex proto-object in the namespace. Ouch. :-( Anyway, that's a wider
issue and not specific to this ticket, so treating as resolved.

Actually, coercion is done with postcircumfix​:<( )> on the type.
See S13.

Pm

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant