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

Null PMC access in isa() when calling non-existant rule #721

Closed
p6rt opened this issue Feb 25, 2009 · 9 comments
Closed

Null PMC access in isa() when calling non-existant rule #721

p6rt opened this issue Feb 25, 2009 · 9 comments

Comments

@p6rt
Copy link

p6rt commented Feb 25, 2009

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

Searchable as RT63458$

@p6rt
Copy link
Author

p6rt commented Feb 25, 2009

From @moritz

09​:45 <@​moritz_> rakudo​: sub m (&f) { say "a" ~~ m/<f>/ }; regex outer {
a };
  m(&a)
09​:45 < p6eval> rakudo 7f8ba6​: OUTPUT«Null PMC access in isa()␤current
instr.​:
  '!SIGNATURE_BIND' pc 2559 (src/classes/Signature.pir​:377)␤»

note that there's no rule named 'a' defined.

A more helpful error message would be appropriate.

Moritz

--
Moritz Lenz
http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/

@p6rt
Copy link
Author

p6rt commented Feb 27, 2009

From @bacek

On Wed Feb 25 00​:49​:42 2009, mlenz@​physik.uni-wuerzburg.de wrote​:

09​:45 <@​moritz_> rakudo​: sub m (&f) { say "a" ~~ m/<f>/ }; regex outer {
a };
m(&a)
09​:45 < p6eval> rakudo 7f8ba6​: OUTPUT«Null PMC access in isa()␤current
instr.​:
'!SIGNATURE_BIND' pc 2559
(src/classes/Signature.pir​:377)␤»

note that there's no rule named 'a' defined.

A more helpful error message would be appropriate.

Moritz

Patch available at
http://github.com/bacek/rakudo/commit/6a68c91cf0311df9472886caefef750fb2503df4

Now it produces this​:
$ ./perl6 -e 'sub m (&f) { say "a" ~~ m/<f>/ }; regex outer { a }; m(&a)'
Non-Callable argument for f in call to m

--
Bacek

@p6rt
Copy link
Author

p6rt commented Feb 27, 2009

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

@p6rt
Copy link
Author

p6rt commented Mar 2, 2009

From @pmichaud

On Fri, Feb 27, 2009 at 02​:21​:59AM -0800, Vasily Chekalkin via RT wrote​:

On Wed Feb 25 00​:49​:42 2009, mlenz@​physik.uni-wuerzburg.de wrote​:

09​:45 <@​moritz_> rakudo​: sub m (&f) { say "a" ~~ m/<f>/ }; regex outer {
a };
m(&a)
09​:45 < p6eval> rakudo 7f8ba6​: OUTPUT«Null PMC access in isa()␤current
instr.​:
'!SIGNATURE_BIND' pc 2559
(src/classes/Signature.pir​:377)␤»

note that there's no rule named 'a' defined.

A more helpful error message would be appropriate.

Patch available at
http://github.com/bacek/rakudo/commit/6a68c91cf0311df9472886caefef750fb2503df4

The patch conflates the concepts of "null" and "defined".
Instead of checking for a defined value, it should be checking
for a null value and doing the right thing after that.

This is also related to RT #​62948, where null values appear
in arrays and other aggregates. Instead of adding a bunch
of "is this value null" checks throughout the code, I'd
prefer to look for a way to automatically promote nulls
into undefs at the appropriate points.

Pm

@p6rt
Copy link
Author

p6rt commented Mar 2, 2009

From @pmichaud

On Tue, Mar 03, 2009 at 10​:21​:33AM +1100, Vasily Chekalkin wrote​:

Patrick R. Michaud wrote​:

This is also related to RT #​62948, where null values appear in arrays and other aggregates. Instead of adding a bunch of "is this value null" checks throughout the code, I'd prefer to look for a way to automatically promote nulls into undefs at the appropriate points.

Is it feasible to catch all "Null PMC access" exceptions at the top-level,
promote PMCNULL to Undef (or Failure) and resume from exception?

Good thinking... but there's not anything to "promote" -- i.e.,
from an exception handler we wouldn't have the ability to change
the register that has the PMCNULL.

Pm

@p6rt
Copy link
Author

p6rt commented Mar 3, 2009

From @pmichaud

On Tue, Mar 03, 2009 at 11​:01​:22AM +1100, Vasily Chekalkin wrote​:

Patrick R. Michaud wrote​:

Is it feasible to catch all "Null PMC access" exceptions at the
top-level, promote PMCNULL to Undef (or Failure) and resume from
exception?

Good thinking... but there's not anything to "promote" -- i.e., from an
exception handler we wouldn't have the ability to change the register that
has the PMCNULL.

Ouch. Looks like '!NULLORUNDEF' subroutine which returns boolean one of
few possible variants?

No, we can clean it up better at the source than we can by spreading
lots of NULLORUNDEF calls throughout the codebase.

Pm

@p6rt
Copy link
Author

p6rt commented Mar 3, 2009

From @bacek

Patrick R. Michaud wrote​:

Is it feasible to catch all "Null PMC access" exceptions at the
top-level, promote PMCNULL to Undef (or Failure) and resume from
exception?

Good thinking... but there's not anything to "promote" -- i.e., from an
exception handler we wouldn't have the ability to change the register that
has the PMCNULL.

Ouch. Looks like '!NULLORUNDEF' subroutine which returns boolean one of few
possible variants?

--
Bacek

@p6rt
Copy link
Author

p6rt commented Mar 3, 2009

From @bacek

Patrick R. Michaud wrote​:

This is also related to RT #​62948, where null values appear in arrays and other aggregates. Instead of adding a bunch of "is this value null" checks throughout the code, I'd prefer to look for a way to automatically promote nulls into undefs at the appropriate points.

Is it feasible to catch all "Null PMC access" exceptions at the top-level, promote PMCNULL to Undef (or Failure) and resume from exception?

--
Bacek

@p6rt p6rt closed this as completed Apr 30, 2010
@p6rt
Copy link
Author

p6rt commented Apr 30, 2010

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant