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

can't call subs with namespaces, such as Foo::bar() #621

Closed
p6rt opened this issue Jan 13, 2009 · 8 comments
Closed

can't call subs with namespaces, such as Foo::bar() #621

p6rt opened this issue Jan 13, 2009 · 8 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jan 13, 2009

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

Searchable as RT62326$

@p6rt
Copy link
Author

p6rt commented Jan 13, 2009

From @moritz

00​:11 <@​moritz_> rakudo​: module A { sub b { return 'bar' }}; say A​::b()
00​:11 < p6eval> rakudo 35511​: OUTPUT«b␤»

should return 'bar', of course

00​:12 <@​moritz_> rakudo​: module A { sub b($x) { return 'bar' }}; say
  A​::b("blubb")
00​:12 < p6eval> rakudo 35511​: OUTPUT«bblubb␤»

even more curious ;-)

00​:12 <@​jnthn> rakudo​: module A { sub b { return 'bar' }}; say A​::b
00​:12 < p6eval> rakudo 35511​: OUTPUT«bar␤»

works

00​:13 <@​jnthn> rakudo​: module A { sub b { return 'bar' }}; say A​::b()
00​:13 < p6eval> rakudo 35511​: OUTPUT«b␤»

doesn't

00​:16 <@​moritz_> rakudo​: module A { sub b($x) { return 'bar' }}; say
  (A​::b("blubb")).perl
00​:16 < p6eval> rakudo 35513​: OUTPUT«[{ ... }, "blubb"]␤»

So A​::b() actually returns a Code object?

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Jan 13, 2009

From @moritz

On Tue Jan 13 15​:18​:05 2009, moritz wrote​:

00​:11 <@​moritz_> rakudo​: module A { sub b { return 'bar' }}; say A​::b()
00​:11 < p6eval> rakudo 35511​: OUTPUT«b␤»

The tests in t/spec/S11-modules/export.t did still pass because their
return value used to be their name only. I've changed that, and TODO'ed
three tests that now fail.

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Jan 13, 2009

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

@p6rt
Copy link
Author

p6rt commented Jan 15, 2009

From @jeffhorwitz

the Foo​::bar() format for calling subs no longer works as of r35597. for
me personally, it's a blocker for mod_perl6.

if i run the following script, the second sub call never happens, and
there is no error.

  module Foo;

  sub bar($arg)
  {
  say $arg;
  }

  bar("without namespace");
  Foo​::bar("with namespace");

[jeff@​groovy perl6]$ ../../parrot perl6.pbc x.p6
without namespace
[jeff@​groovy perl6]$

the PIR shows that instead of invoking the sub, rakudo is invoking "infix​:,"​:

.namespace ["Foo"]
.sub "_block20" :subid("12")
  .const 'Sub' $P23 = "13"
  capture_lex $P23
  $P22 = "!meta_create"("module", "Foo", 0)
  .local pmc metaclass
  set metaclass, $P22
  "!meta_compose"(metaclass)
  new $P33, "Str"
  assign $P33, "without namespace"
  "bar"($P33)
  get_hll_global $P34, ["Foo"], "bar"
  new $P35, "Str"
  assign $P35, "with namespace"
  $P36 = "infix​:,"($P34, $P35) # <--- offending code here
  .return ($P36)
.end

-jeff

@p6rt
Copy link
Author

p6rt commented Jan 15, 2009

From @moritz

This is the same bug as RT #​62326, with a bit different analysis. Merging.

@p6rt
Copy link
Author

p6rt commented Jan 19, 2009

From @jnthn

On Tue Jan 13 15​:18​:05 2009, moritz wrote​:

00​:11 <@​moritz_> rakudo​: module A { sub b { return 'bar' }}; say A​::b()
00​:11 < p6eval> rakudo 35511​: OUTPUT«b␤»

should return 'bar', of course

This and the various other cases in this ticket are resolved in r35763.

Thanks!

Jonathan

1 similar comment
@p6rt
Copy link
Author

p6rt commented Jan 19, 2009

From @jnthn

On Tue Jan 13 15​:18​:05 2009, moritz wrote​:

00​:11 <@​moritz_> rakudo​: module A { sub b { return 'bar' }}; say A​::b()
00​:11 < p6eval> rakudo 35511​: OUTPUT«b␤»

should return 'bar', of course

This and the various other cases in this ticket are resolved in r35763.

Thanks!

Jonathan

@p6rt p6rt closed this as completed Jan 19, 2009
@p6rt
Copy link
Author

p6rt commented Jan 19, 2009

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

@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