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

Class attributes without accessors don't work in Rakudo #334

Closed
p6rt opened this issue Sep 20, 2008 · 32 comments
Closed

Class attributes without accessors don't work in Rakudo #334

p6rt opened this issue Sep 20, 2008 · 32 comments

Comments

@p6rt
Copy link

p6rt commented Sep 20, 2008

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

Searchable as RT59118$

@p6rt
Copy link
Author

p6rt commented Aug 12, 2008

From @masak

r30188​:
$ ./perl6 -e 'class A { my $.x = 7; say $.x }' # segfaults
Lexical 'self' not found
[...]
Segmentation fault

Not sure if the error message from Pugs is right either. Should it be
looking for 'self' at this stage? What should the program really do,
print out the variable or disallow statements within a class
declaration but outside methods?

@p6rt
Copy link
Author

p6rt commented Aug 13, 2008

From @chromatic

On Tuesday 12 August 2008 14​:17​:22 Carl Mäsak wrote​:

# New Ticket Created by "Carl Mäsak"
# Please include the string​: [perl #​57882]
# in the subject line of all future correspondence about this issue.
# <URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=57882 >

r30188​:
$ ./perl6 -e 'class A { my $.x = 7; say $.x }' # segfaults
Lexical 'self' not found
[...]
Segmentation fault

This is another double-free abort like the one in RT #​57710. The fix is
likely similar to r30149.

-- c

@p6rt
Copy link
Author

p6rt commented Aug 13, 2008

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

@p6rt
Copy link
Author

p6rt commented Sep 20, 2008

From @masak

Rakudo r31286 doesn't seem to recognize class attributes with the '!' twigil.

$ ./perl6 -e 'class A { my $.b; method x { $.b = "b" } }; A.new.x' # works fine

$ ./perl6 -e 'class A { my $.b; method x { $!b = "b" } }; A.new.x' #
fails unexpectedly
No such attribute '$!b'
[...]

$ ./perl6 -e 'class A { my $!b; method x { $!b = "b" } }; A.new.x' #
fails and segfaults
No such attribute '$!b'
[...]
Segmentation fault

@p6rt
Copy link
Author

p6rt commented Sep 22, 2008

From @moritz

On Sat Sep 20 05​:20​:28 2008, masak wrote​:

Rakudo r31286 doesn't seem to recognize class attributes with the '!'
twigil.

$ ./perl6 -e 'class A { my $.b; method x { $.b = "b" } }; A.new.x' #
works fine

$ ./perl6 -e 'class A { my $.b; method x { $!b = "b" } }; A.new.x' #
fails unexpectedly
No such attribute '$!b'
[...]

$ ./perl6 -e 'class A { my $!b; method x { $!b = "b" } }; A.new.x' #
fails and segfaults
No such attribute '$!b'
[...]
Segmentation fault

We have a lack of OO tests in t/spec/, mostly because I don't understand
the OO system very well, so I can't move them over there.

So anybody with some understanding of Perl 6 OO, please help to increase
the test situation in t/spec/S12-*

Moritz

@p6rt
Copy link
Author

p6rt commented Sep 22, 2008

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

@p6rt
Copy link
Author

p6rt commented Jan 11, 2009

From @pmichaud

On Tue Aug 12 14​:17​:20 2008, masak wrote​:

r30188​:
$ ./perl6 -e 'class A { my $.x = 7; say $.x }' # segfaults
Lexical 'self' not found
[...]
Segmentation fault

Not sure if the error message from Pugs is right either. Should it be
looking for 'self' at this stage? What should the program really do,
print out the variable or disallow statements within a class
declaration but outside methods?

Since $.x is really equivalent to self.x, I suspect that Rakudo and Pugs
have this one correct and using $.x in the say statement is an error.
Either that or the body of the class declaration needs to have an
implicit self (perhaps the protoobject?). We probably need
clarification from p6l on this one.

AFAIK, statements are definitely allowed in method and class declaration
bodies.

Pm

@p6rt
Copy link
Author

p6rt commented Jan 12, 2009

From @masak

Patrick (>), Carl (>>)​:

r30188​:
$ ./perl6 -e 'class A { my $.x = 7; say $.x }' # segfaults
Lexical 'self' not found
[...]
Segmentation fault

Not sure if the error message from Pugs is right either. Should it be
looking for 'self' at this stage? What should the program really do,
print out the variable or disallow statements within a class
declaration but outside methods?

Since $.x is really equivalent to self.x, I suspect that Rakudo and Pugs
have this one correct and using $.x in the say statement is an error.
Either that or the body of the class declaration needs to have an
implicit self (perhaps the protoobject?). We probably need
clarification from p6l on this one.

It's funny that this bug resurfaces just as I try something like this in Rakudo​:

class SomeClass {
  my $.warn_limit = 1000;
  my $.stern_warn_limit = $.warn_limit * 1.05;
  my $.expel_limit = $.warn_limit * 1.10;

  # ...
}

And have it fail. Were my assumptions unreasonable in the above case?
I don't think so, but OTOH I don't find something in S12 that talks
about this, so I think I'm on unspecced territory.

I'll re-pose this question to p6l.

// Carl

@p6rt
Copy link
Author

p6rt commented Sep 15, 2009

From @Util

Consider these two classes, both faulty in the same way​:
  class B0rk { say $.a };
  class Chef { say $.b };

Each class makes reference to a attribute that has not been declared,
and so should fail to compile​:
  $ ./perl6 -e 'class B0rk { say $.a }; say "Done";'
  Lexical 'self' not found

  $ ./perl6 -e 'class Chef { say $.b }; say "Done";'
  Lexical 'self' not found
While the error message might not be helpful, its shortcomings are not
important to this issue.
The important thing is that *some* error is produced, and that
compilation is aborted.
All is working as expected, when the classes are directly compiled.

Either class, when evaled solo, behaves as expected. Execution
proceeds, and the error message is placed in $!.
  $ ./perl6 -e 'eval q[ class B0rk { say $.a; }; ]; say "Done";'
  Done

  $ ./perl6 -e 'eval q[ class Chef { say $.b; }; ]; say "Done";'
  Done

  $ ./perl6 -e 'eval q[ class B0rk { say $.a; }; ]; say $!;'
  Lexical 'self' not found

  $ ./perl6 -e 'eval q[ class Chef { say $.b; }; ]; say $!;'
  Lexical 'self' not found

All is working as expected, when the classes are evaled in isolation
from each other.

Evaling the classes together produces two different unexpected
behaviours, depending on how the code is combined.
First, we put both classes into the same string to be evaled once.
  $ ./perl6 -e 'eval q[ class B0rk { say $.a; }; class Chef { say
$.b; }; ]; say "Done";'
  Done
  Lexical 'self' not found
  current instr.​: 'perl6;Chef;_block43' pc -1 ((unknown file)​:-1)
  called from Sub 'perl6;Perl6;Compiler;main' pc -1 ((unknown
file)​:-1)
We did not tell $! to print; the error is produced on STDERR, even
though the `eval` should have trapped it.

Next, we eval both classes in the same program, but in separate eval
statements​:
  $ ./perl6 -e 'eval q[ class B0rk { say $.a; }; ]; eval q[ class
Chef { say $.b; }; ]; say "Done";'
  Done
  src/call/pcc.c​:609​: failed assertion 'PObj_is_PMC_TEST(sig_pmc)'
  Backtrace - Obtained 24 stack frames (max trace depth is 32).
  0 libparrot.dylib 0x0052836d
Parrot_do_check_events + 173
  1 libparrot.dylib 0x005284d7 Parrot_confess
+ 151
  2 libparrot.dylib 0x0054171b
Parrot_init_arg_op + 315
  3 libparrot.dylib 0x005447c2
parrot_pass_args + 978
  4 libparrot.dylib 0x00544936
parrot_pass_args + 1350
  5 libparrot.dylib 0x0054a74c
Parrot_runops_fromc_args + 220
  6 libparrot.dylib 0x005924d5
Parrot_ComposeRole + 3461
  7 libparrot.dylib 0x0059278a
Parrot_ComposeRole + 4154
  8 libparrot.dylib 0x00592a96 do_sub_pragmas
+ 406
  9 libparrot.dylib 0x0059a467
PackFile_fixup_subs + 119
  10 libparrot.dylib 0x00758d25 do_yylex_init
+ 1317
  11 libparrot.dylib 0x00759165 do_yylex_init
+ 2405
  12 libparrot.dylib 0x005595c0
Parrot_mmd_cache_destroy + 2096
  13 libparrot.dylib 0x00678601
Parrot_Eval_get_isa + 2097
  14 libparrot.dylib 0x004a8fa2
Parrot_str_from_int + 3650
  15 libparrot.dylib 0x005a3977
enable_event_checking + 2679
  16 libparrot.dylib 0x005a256a
Parrot_runcore_switch + 4058
  17 libparrot.dylib 0x00549705
new_runloop_jump_point + 389
  18 libparrot.dylib 0x00549a26
new_runloop_jump_point + 1190
  19 libparrot.dylib 0x0054a72a
Parrot_runops_fromc_args + 186
  20 libparrot.dylib 0x005251e1 Parrot_runcode
+ 337
  21 perl6 0x00001ba9 start + 505
  22 perl6 0x000019e6 start + 54
  23 ??? 0x00000003 0x0 + 3
  Abort trap

Notice that in both of the last cases, "Done" *did* print, so neither
compilation nor execution were halted; the diagnostic output seems to
have been produced during program exit.

--
Hope this helps
Bruce Gray (Util on IRC)

@p6rt
Copy link
Author

p6rt commented Sep 16, 2009

From @moritz

Thanks for the ticket, it's a very good catch and analysis.
I have some small comments on it​:

Bruce Gray (via RT) wrote​:

# New Ticket Created by Bruce Gray
# Please include the string​: [perl #​69160]
# in the subject line of all future correspondence about this issue.
# <URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=69160 >

Consider these two classes, both faulty in the same way​:
class B0rk { say $.a };
class Chef { say $.b };

Each class makes reference to a attribute that has not been declared,
and so should fail to compile​:
$ ./perl6 -e 'class B0rk { say $.a }; say "Done";'
Lexical 'self' not found

 $ \./perl6 \-e 'class Chef \{ say $\.b \}; say "Done";'
 Lexical 'self' not found

While the error message might not be helpful, its shortcomings are not
important to this issue.
The important thing is that *some* error is produced, and that
compilation is aborted.
All is working as expected, when the classes are directly compiled.

Either class, when evaled solo, behaves as expected. Execution
proceeds, and the error message is placed in $!.
$ ./perl6 -e 'eval q[ class B0rk { say $.a; }; ]; say "Done";'
Done

 $ \./perl6 \-e 'eval q\[ class Chef \{ say $\.b; \}; \]; say "Done";'
 Done

 $ \./perl6 \-e 'eval q\[ class B0rk \{ say $\.a; \}; \]; say $\!;'
 Lexical 'self' not found

 $ \./perl6 \-e 'eval q\[ class Chef \{ say $\.b; \}; \]; say $\!;'
 Lexical 'self' not found

All is working as expected, when the classes are evaled in isolation
from each other.

Evaling the classes together produces two different unexpected
behaviours, depending on how the code is combined.
First, we put both classes into the same string to be evaled once.
$ ./perl6 -e 'eval q[ class B0rk { say $.a; }; class Chef { say
$.b; }; ]; say "Done";'
Done
Lexical 'self' not found
current instr.​: 'perl6;Chef;_block43' pc -1 ((unknown file)​:-1)
called from Sub 'perl6;Perl6;Compiler;main' pc -1 ((unknown
file)​:-1)
We did not tell $! to print; the error is produced on STDERR, even
though the `eval` should have trapped it.

And it's quite curious that the "Done" is printed before the error message.

Next, we eval both classes in the same program, but in separate eval
statements​:
$ ./perl6 -e 'eval q[ class B0rk { say $.a; }; ]; eval q[ class
Chef { say $.b; }; ]; say "Done";'
Done
src/call/pcc.c​:609​: failed assertion 'PObj_is_PMC_TEST(sig_pmc)'
Backtrace - Obtained 24 stack frames (max trace depth is 32).
0 libparrot.dylib 0x0052836d
Parrot_do_check_events + 173
1 libparrot.dylib 0x005284d7 Parrot_confess
+ 151
2 libparrot.dylib 0x0054171b
Parrot_init_arg_op + 315
3 libparrot.dylib 0x005447c2
parrot_pass_args + 978
4 libparrot.dylib 0x00544936
parrot_pass_args + 1350
5 libparrot.dylib 0x0054a74c
Parrot_runops_fromc_args + 220
6 libparrot.dylib 0x005924d5
Parrot_ComposeRole + 3461
7 libparrot.dylib 0x0059278a
Parrot_ComposeRole + 4154
8 libparrot.dylib 0x00592a96 do_sub_pragmas
+ 406
9 libparrot.dylib 0x0059a467
PackFile_fixup_subs + 119
10 libparrot.dylib 0x00758d25 do_yylex_init
+ 1317
11 libparrot.dylib 0x00759165 do_yylex_init
+ 2405
12 libparrot.dylib 0x005595c0
Parrot_mmd_cache_destroy + 2096
13 libparrot.dylib 0x00678601
Parrot_Eval_get_isa + 2097
14 libparrot.dylib 0x004a8fa2
Parrot_str_from_int + 3650
15 libparrot.dylib 0x005a3977
enable_event_checking + 2679
16 libparrot.dylib 0x005a256a
Parrot_runcore_switch + 4058
17 libparrot.dylib 0x00549705
new_runloop_jump_point + 389
18 libparrot.dylib 0x00549a26
new_runloop_jump_point + 1190
19 libparrot.dylib 0x0054a72a
Parrot_runops_fromc_args + 186
20 libparrot.dylib 0x005251e1 Parrot_runcode
+ 337
21 perl6 0x00001ba9 start + 505
22 perl6 0x000019e6 start + 54
23 ??? 0x00000003 0x0 + 3
Abort trap

Notice that in both of the last cases, "Done" *did* print, so neither
compilation nor execution were halted; the diagnostic output seems to
have been produced during program exit.

The back trace at exit is a known parrot problem, the so-called
"inferior run-loop" problem.
If you are interested in the morbid details (I hope I get them correctly)​:
eval() starts another run loop in parrot. Some parts (I think it's IMCC,
ie parrots PIR compiler) doesn't clean up very well after itself if
there's a failure in compilation, leaving some mess behind.
During global destruction parrot sees this junk and chokes.

It's the same problem that makes rakudo fail on exit on the test file
t/spec/S12-attributes/class.t, known to the parrot folks and not easily
solved (but being worked on).

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Sep 16, 2009

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

@p6rt
Copy link
Author

p6rt commented Mar 2, 2010

From @masak

<masak> std​: my Any %.x=3,%.x;
<p6eval> std 29917​: OUTPUT«ok 00​:01 109m␤»
<masak> rakudo​: my Any %.x=3,%.x;
<p6eval> rakudo 6867a5​: OUTPUT«Lexical 'self' not found [...]
* masak submits LTA rakudobug

In my opinion, it should give an error already at the wonky declaration.

@p6rt
Copy link
Author

p6rt commented Mar 21, 2010

From @ShimmerFairy

class A { has $.b; method x { $!b = "b" } }; A.new.x

this works.
--
Don't Panic!

@p6rt
Copy link
Author

p6rt commented Mar 21, 2010

From @masak

On Sun Mar 21 14​:33​:26 2010, lue wrote​:

class A { has $.b; method x { $!b = "b" } }; A.new.x

this works.

Sure, but that doesn't create a class attribute, as was the topic of this
ticket. :) The 'has' declarator gives each object instance its own attribute,
whereas the ordinary 'my' declarator in a class scope creates a class-wide
attribute.

@p6rt
Copy link
Author

p6rt commented Mar 22, 2010

From @jnthn

Carl Mäsak via RT wrote​:

On Sun Mar 21 14​:33​:26 2010, lue wrote​:

class A { has $.b; method x { $!b = "b" } }; A.new.x

this works.

Sure, but that doesn't create a class attribute, as was the topic of this
ticket. :) The 'has' declarator gives each object instance its own attribute, whereas the ordinary 'my' declarator in a class scope creates a class-wide attribute.

AFAIK, it's just syntactic sugar for declaring a lexical variable and
generating an l-value method related to it. It doesn't create a $!foo,
but a $foo. A $!foo is always unambiguously an instance attribute.

Jonathan

@p6rt
Copy link
Author

p6rt commented Mar 22, 2010

From @masak

lue (>>>), Carl (>>), Jonathan (>)​:

class A { has $.b; method x { $!b = "b" } }; A.new.x

this works.

Sure, but that doesn't create a class attribute, as was the topic of this
ticket. :) The 'has' declarator gives each object instance its own
attribute, whereas the ordinary 'my' declarator in a class scope creates a
class-wide attribute.

AFAIK, it's just syntactic sugar for declaring a lexical variable and
generating an l-value method related to it. It doesn't create a $!foo, but a
$foo. A $!foo is always unambiguously an instance attribute.

It's a bit weak, but S12​:711 seems to contradict that​:

  my %!cache is rw; # generates no public accessor

In my opinion, if the class attribute has a C<.> or C<!> twigil, there
should be a C<!>-twigil version of it.

// Carl

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

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

@p6rt
Copy link
Author

p6rt commented Apr 26, 2011

From @colomon

colomon​: rakudo​: class A { has $.a, $.b; }; A.new(a => 1, b => 10);
p6eval​: rakudo 8533c3​: OUTPUT«Null PMC access in find_method('b')␤ in
main program body at line 2​:/tmp/omKsZib4Dk␤»

--
Solomon Foster​: colomon@​gmail.com
HarmonyWare, Inc​: http://www.harmonyware.com

@p6rt
Copy link
Author

p6rt commented Sep 20, 2011

From @coke

On Wed Sep 16 02​:56​:54 2009, moritz wrote​:

Thanks for the ticket, it's a very good catch and analysis.
I have some small comments on it​:

Bruce Gray (via RT) wrote​:

# New Ticket Created by Bruce Gray
# Please include the string​: [perl #​69160]
# in the subject line of all future correspondence about this issue.
# <URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=69160 >

Consider these two classes, both faulty in the same way​:
class B0rk { say $.a };
class Chef { say $.b };

Failure mode changed, and is now more consistent, but worse.

$ ./perl6 -e 'class B0rk { say $.a };'
Null PMC access in find_method('a')

$ ./perl6 -e 'class Chef { say $.b };'
Null PMC access in find_method('b')

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jan 11, 2012

From @coke

On Tue Aug 12 14​:17​:20 2008, masak wrote​:

r30188​:
$ ./perl6 -e 'class A { my $.x = 7; say $.x }' # segfaults
Lexical 'self' not found
[...]
Segmentation fault

Not sure if the error message from Pugs is right either. Should it be
looking for 'self' at this stage? What should the program really do,
print out the variable or disallow statements within a class
declaration but outside methods?

This currently generates a Null PMC access error.

$ ./perl6 -e 'class A { my $.x = 7; say $.x }'
Null PMC access in find_method('x')

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jan 30, 2012

From @masak

<[Coke]> nom​: my %a = { $.idattr => 3 }; say %a.perl
<p6eval> nom ef22e3​: OUTPUT«Null PMC access in find_method('idattr')␤ [...]
<[Coke]> masak, is there a ticket for that?
<masak> [Coke]​: no.
<[Coke]> enjoy. ;)
* masak submits [Coke]'s rakudobug
<masak> nom​: say "before"; my %a = { $.idattr => 3 }; say "alive"
<p6eval> nom ce5cca​: OUTPUT«before␤Null PMC access in
find_method('idattr') [...]
<masak> nom​: class A { my %a = { $.idattr => 3 } }; say "alive"
<p6eval> nom ce5cca​: OUTPUT«Null PMC access in find_method('idattr') [...]
<masak> nom​: class A { has $.idattr; my %a = { $.idattr => 3 } }; say "alive"
<p6eval> nom ce5cca​: OUTPUT«Null PMC access in find_method('idattr') [...]
<masak> nom​: class A { method foo { my %a = { self.idattr => 3 } } };
say "alive"
<p6eval> nom ce5cca​: OUTPUT«alive␤»

@p6rt
Copy link
Author

p6rt commented Feb 1, 2012

From @coke

On Tue Mar 02 10​:38​:41 2010, masak wrote​:

<masak> std​: my Any %.x=3,%.x;
<p6eval> std 29917​: OUTPUT«ok 00​:01 109m␤»
<masak> rakudo​: my Any %.x=3,%.x;
<p6eval> rakudo 6867a5​: OUTPUT«Lexical 'self' not found [...]
* masak submits LTA rakudobug

In my opinion, it should give an error already at the wonky declaration.

Now includes a NULL PMC error​:

09​:09 < [Coke]> rakudo​: my Any %.x=3,%.x; #RT #​73232
09​:09 <+p6eval> rakudo ce5cca​: OUTPUT«Useless declaration of a has-scoped
  method in mainline␤Null PMC access in find_method('x')␤ in
  block <anon> at /tmp/AGDZSzesDD​:1␤ in <anon> at
  /tmp/AGDZSzesDD​:1␤»

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Feb 10, 2012

From @jnthn

On Mon Jan 30 11​:15​:17 2012, masak wrote​:

<[Coke]> nom​: my %a = { $.idattr => 3 }; say %a.perl
<p6eval> nom ef22e3​: OUTPUT«Null PMC access in find_method('idattr')␤
[...]
<[Coke]> masak, is there a ticket for that?
<masak> [Coke]​: no.
<[Coke]> enjoy. ;)
* masak submits [Coke]'s rakudobug

Now​:

my %a = { $.idattr => 3 }; say %a.perl
Variable $.idattr used where no 'self' available at line 1, near " => 3
}; s"

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Feb 10, 2012

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

@p6rt
Copy link
Author

p6rt commented Feb 10, 2012

From @jnthn

On Tue Apr 26 05​:31​:57 2011, Solomon wrote​:

colomon​: rakudo​: class A { has $.a, $.b; }; A.new(a => 1, b => 10);
p6eval​: rakudo 8533c3​: OUTPUT«Null PMC access in find_method('b')␤ in
main program body at line 2​:/tmp/omKsZib4Dk␤»

Now it gives a much more informative error at compile time​:

class A { has $.a, $.b; }; A.new(a => 1, b => 10);
Variable $.b used where no 'self' available at line 1

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Feb 10, 2012

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

@p6rt
Copy link
Author

p6rt commented Apr 9, 2012

From @masak

masak (>>), coke (>)​:

$ ./perl6 -e 'class A { my $.x = 7; say $.x }' # segfaults
Lexical 'self' not found
[...]
Segmentation fault

Not sure if the error message from Pugs is right either. Should it
be
looking for 'self' at this stage? What should the program really do,
print out the variable or disallow statements within a class
declaration but outside methods?

This currently generates a Null PMC access error.

$ ./perl6 -e 'class A { my $.x = 7; say $.x }'
Null PMC access in find_method('x')

<masak> r​: class A { my $.x = 7; say $.x }
<p6eval> rakudo 4373f0​: OUTPUT«===SORRY!===␤Variable $.x used where no
'self' is available␤at /tmp/RPGnuPfYFR​:1␤»
* masak updates https://rt-archive.perl.org/perl6/Ticket/Display.html?id=59118

@p6rt
Copy link
Author

p6rt commented Apr 9, 2012

From @moritz

Current state​:

===SORRY!===
Variable $.x used where no 'self' is available

@p6rt
Copy link
Author

p6rt commented May 29, 2012

From @diakopter

On Wed Feb 01 06​:10​:15 2012, coke wrote​:

On Tue Mar 02 10​:38​:41 2010, masak wrote​:

<masak> std​: my Any %.x=3,%.x;
<p6eval> std 29917​: OUTPUT«ok 00​:01 109m␤»
<masak> rakudo​: my Any %.x=3,%.x;
<p6eval> rakudo 6867a5​: OUTPUT«Lexical 'self' not found [...]
* masak submits LTA rakudobug

In my opinion, it should give an error already at the wonky
declaration.

Now includes a NULL PMC error​:

09​:09 < [Coke]> rakudo​: my Any %.x=3,%.x; #RT #​73232
09​:09 <+p6eval> rakudo ce5cca​: OUTPUT«Useless declaration of a has-
scoped
method in mainline␤Null PMC access in
find_method('x')␤ in
block <anon> at /tmp/AGDZSzesDD​:1␤ in <anon> at
/tmp/AGDZSzesDD​:1␤»

now does the right thing (matches STD). marking testneeded.

15​:18 <diakopter> std​: my Any %.x=3,%.x;
15​:19 <p6eval> std f179a1b​: OUTPUT«===SORRY!===␤Variable %.x used where
no 'self' is
  available at /tmp/JscigSRB2i line 1​:␤------> my Any
%.x=3,⏏%.x;␤Check
  failed␤FAILED 00​:00 43m␤»
15​:19 <diakopter> rakudo​: my Any %.x=3,%.x;
15​:19 <p6eval> rakudo 3b1596​: OUTPUT«Useless declaration of a has-scoped
method in
  mainline␤===SORRY!===␤Variable %.x used where no 'self'
is available␤at
  /tmp/jSJT05uNK1​:1␤»

@p6rt
Copy link
Author

p6rt commented May 29, 2012

From @diakopter

On Mon Sep 19 17​:46​:17 2011, coke wrote​:

On Wed Sep 16 02​:56​:54 2009, moritz wrote​:

Thanks for the ticket, it's a very good catch and analysis.
I have some small comments on it​:

Bruce Gray (via RT) wrote​:

# New Ticket Created by Bruce Gray
# Please include the string​: [perl #​69160]
# in the subject line of all future correspondence about this
issue.
# <URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=69160 >

Consider these two classes, both faulty in the same way​:
class B0rk { say $.a };
class Chef { say $.b };

Failure mode changed, and is now more consistent, but worse.

$ ./perl6 -e 'class B0rk { say $.a };'
Null PMC access in find_method('a')

$ ./perl6 -e 'class Chef { say $.b };'
Null PMC access in find_method('b')

works now, testneeded. duplicate of another 1 or 2 tickets though.

16​:09 <diakopter> r​: class B0rk { say $.a };
16​:09 <p6eval> rakudo 3b1596​: OUTPUT«===SORRY!===␤Variable $.a used
where no 'self' is
  available␤at /tmp/QqPFspxVLh​:1␤»

@p6rt
Copy link
Author

p6rt commented Aug 7, 2012

From @moritz

Now tested in S32-exceptions/misc.t

@p6rt
Copy link
Author

p6rt commented Aug 7, 2012

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

@p6rt p6rt closed this as completed Aug 7, 2012
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