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

subset types and multi dispatch don't mix #298

Closed
p6rt opened this issue Sep 5, 2008 · 7 comments
Closed

subset types and multi dispatch don't mix #298

p6rt opened this issue Sep 5, 2008 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Sep 5, 2008

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

Searchable as RT58602$

@p6rt
Copy link
Author

p6rt commented Sep 5, 2008

From @moritz

Rakudo r30787 dies on multi dispatch when subset types are involved​:

test file​:

subset Even of Int where { $_ % 2 == 0 };
subset Odd of Int where { $_ % 2 == 1 };

multi sub test_subtypes(Even $y){ 'Even' }
multi sub test_subtypes(Odd $y){ 'Odd' }
say test_subtypes(3)

dies with
No applicable methods.

Adding debugging statements to both where blocks reveals that neither of
them is ever called.

I added a few tests for that to t/spec/S12-subset/multi-dispatch.t

Moritz

--
Moritz Lenz
http://moritz.faui2k3.org/ | http://perl-6.de/

@p6rt
Copy link
Author

p6rt commented Sep 11, 2008

From @jnthn

On Fri Sep 05 08​:26​:34 2008, moritz@​casella.verplant.org wrote​:

Rakudo r30787 dies on multi dispatch when subset types are involved​:

Yes; this ticket depends on us switching over to the new
multi-dispatcher (perl6multisub.pmc), which does handle this case. I
hope to get that sorted out in the near future.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Sep 11, 2008

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

@p6rt
Copy link
Author

p6rt commented Sep 14, 2008

From @moritz

jnthn@​jnthn.net via RT wrote​:

On Fri Sep 05 08​:26​:34 2008, moritz@​casella.verplant.org wrote​:

Rakudo r30787 dies on multi dispatch when subset types are involved​:

Yes; this ticket depends on us switching over to the new
multi-dispatcher (perl6multisub.pmc), which does handle this case. I
hope to get that sorted out in the near future.

Currently (r31122) the example dies with "Ambiguous dispatch.".

(On a related note, could we get more verbose error messages? "Ambiguous
dispatch for { sub | method } $name" would be more helpful.)

Moritz

--
Moritz Lenz
http://moritz.faui2k3.org/ | http://perl-6.de/

@p6rt
Copy link
Author

p6rt commented Nov 11, 2008

From @jnthn

On Fri Sep 05 08​:26​:34 2008, moritz@​casella.verplant.org wrote​:

Rakudo r30787 dies on multi dispatch when subset types are involved​:

test file​:

subset Even of Int where { $_ % 2 == 0 };
subset Odd of Int where { $_ % 2 == 1 };

multi sub test_subtypes(Even $y){ 'Even' }
multi sub test_subtypes(Odd $y){ 'Odd' }
say test_subtypes(3)

dies with
No applicable methods.

I just checked this after further fixes to Perl6MultiSub and am happy to
say that as of r32528 this now works (whether that's the revision it
started working in, I'm not sure - but it does the Right Thing.)

Thanks!

Jonathan

@p6rt
Copy link
Author

p6rt commented Nov 11, 2008

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

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

p6rt commented Nov 11, 2008

From @chromatic

On Sunday 14 September 2008 12​:48​:07 Moritz Lenz wrote​:

Currently (r31122) the example dies with "Ambiguous dispatch.".

(On a related note, could we get more verbose error messages? "Ambiguous
dispatch for { sub | method } $name" would be more helpful.)

Added in r32552.

-- c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant