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

calling nextsame in an proto causes a Null PMC Access #1820

Closed
p6rt opened this issue Jun 9, 2010 · 7 comments
Closed

calling nextsame in an proto causes a Null PMC Access #1820

p6rt opened this issue Jun 9, 2010 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Jun 9, 2010

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

Searchable as RT75640$

@p6rt
Copy link
Author

p6rt commented Jun 9, 2010

From @moritz

proto sub a($x) is export { say "in proto"; nextsame }
sub a(Str $x) { say "Str $x" };
sub a(Int $x) { say "Int $x" };

a([]);

causes

in proto
Null PMC access in clone()
  in 'a' at line 1
  in main program body at line 5​:Foo.pm

Note that even when the nextsame() dispatch should succeed (in case the
proto is exported, and on calls a(3) from a calling module) the same
error occurs

@p6rt
Copy link
Author

p6rt commented Jul 29, 2010

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

@p6rt
Copy link
Author

p6rt commented Oct 3, 2011

From @coke

On Wed Jun 09 10​:50​:59 2010, moritz wrote​:

proto sub a($x) is export { say "in proto"; nextsame }
sub a(Str $x) { say "Str $x" };
sub a(Int $x) { say "Int $x" };

a([]);

causes

in proto
Null PMC access in clone()
in 'a' at line 1
in main program body at line 5​:Foo.pm

Note that even when the nextsame() dispatch should succeed (in case
the
proto is exported, and on calls a(3) from a calling module) the same
error occurs

This now dies with​:

$ ./perl6 foo
===SORRY!===
Illegal redeclaration of routine 'a' at line 2, near ";\nsub a(In"

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 3, 2012

From @moritz

On Mon Oct 03 11​:40​:26 2011, coke wrote​:

On Wed Jun 09 10​:50​:59 2010, moritz wrote​:

proto sub a($x) is export { say "in proto"; nextsame }
sub a(Str $x) { say "Str $x" };
sub a(Int $x) { say "Int $x" };

a([]);

causes

in proto
Null PMC access in clone()
in 'a' at line 1
in main program body at line 5​:Foo.pm

Note that even when the nextsame() dispatch should succeed (in case
the
proto is exported, and on calls a(3) from a calling module) the same
error occurs

This now dies with​:

$ ./perl6 foo
===SORRY!===
Illegal redeclaration of routine 'a' at line 2, near ";\nsub a(In"

There's the separate issue (already documented elsewhere) that a proto
doesn't auto-promote subs in the same lexical scope to multis. If one
works around this problem by writing

proto sub a($x) is export { say "in proto"; nextsame }
sub a(Str $x) { say "Str $x" };
sub a(Int $x) { say "Int $x" };

a([]);

the output with current Rakudo is

in proto
nextsame is not in the dynamic scope of a dispatcher

which I believe is correct, since dispatching from the proto to its
candidates is now done with {*} and not with nextsame.

So closable with tests.

@p6rt
Copy link
Author

p6rt commented Oct 4, 2012

From @moritz

On Wed Oct 03 13​:14​:00 2012, moritz wrote​:

There's the separate issue (already documented elsewhere) that a proto
doesn't auto-promote subs in the same lexical scope to multis. If one
works around this problem by writing

proto sub a($x) is export { say "in proto"; nextsame }
sub a(Str $x) { say "Str $x" };
sub a(Int $x) { say "Int $x" };

sorry, I meant
multi sub a(Str $x) { ... }
multi sub a(Int $x) { ... }

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Jan 3, 2013

From @moritz

tested in S32-exceptions/misc.t.

@p6rt
Copy link
Author

p6rt commented Jan 3, 2013

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

@p6rt p6rt closed this as completed Jan 3, 2013
@p6rt p6rt added the testneeded label Jan 5, 2020
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