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

First bindable multi MAIN candidate chosen in Rakudo, not the best one #2441

Closed
p6rt opened this issue Jun 16, 2011 · 5 comments
Closed

First bindable multi MAIN candidate chosen in Rakudo, not the best one #2441

p6rt opened this issue Jun 16, 2011 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jun 16, 2011

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

Searchable as RT92986$

@p6rt
Copy link
Author

p6rt commented Jun 16, 2011

From @masak

<colomon> what I'm seeing (this is in master)​: MAIN(Int $n) doesn't
work. MAIN($n) works, but then hides MAIN("test") (ie if the
command-line argument is "test", MAIN($n) is called. Help?
<masak> colomon​: the former is well-known. the latter sounds weird and new.
<colomon> masak​: https://gist.github.com/1030030

multi sub MAIN($n) {
  say "main $n { $n.WHAT }";
}

multi sub MAIN("test") {
  say "main test (ie test case)";
}

<moritz> colomon​: re-order the mutlis
<masak> huh, what?
<moritz> colomon​: thing is, the main helper doesn't do a proper multi
dispatch (yet)
<masak> ah.
<colomon> moritz++
<moritz> but it just iterates over the candidates, and invokes the
first one it can bind to
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Oct 20, 2011

From @jnthn

On Thu Jun 16 12​:33​:22 2011, masak wrote​:

<colomon> what I'm seeing (this is in master)​: MAIN(Int $n) doesn't
work. MAIN($n) works, but then hides MAIN("test") (ie if the
command-line argument is "test", MAIN($n) is called. Help?
<masak> colomon​: the former is well-known. the latter sounds weird and
new.
<colomon> masak​: https://gist.github.com/1030030

multi sub MAIN($n) {
say "main $n { $n.WHAT }";
}

multi sub MAIN("test") {
say "main test (ie test case)";
}

<moritz> colomon​: re-order the mutlis
<masak> huh, what?
<moritz> colomon​: thing is, the main helper doesn't do a proper multi
dispatch (yet)
<masak> ah.
<colomon> moritz++
<moritz> but it just iterates over the candidates, and invokes the
first one it can bind to
* masak submits rakudobug

Works now thanks to patches from japhb++. Note that it needs to be
"$n.WHAT.gist" these days.

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Oct 20, 2011

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

@p6rt
Copy link
Author

p6rt commented Apr 5, 2012

From @moritz

Tested in S06-other/main-usage.t.

@p6rt
Copy link
Author

p6rt commented Apr 5, 2012

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

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

No branches or pull requests

1 participant