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

Rakudo parses placeholder parameters in class attribute definitions #2197

Closed
p6rt opened this issue Sep 28, 2010 · 8 comments
Closed

Rakudo parses placeholder parameters in class attribute definitions #2197

p6rt opened this issue Sep 28, 2010 · 8 comments

Comments

@p6rt
Copy link

p6rt commented Sep 28, 2010

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

Searchable as RT78112$

@p6rt
Copy link
Author

p6rt commented Sep 28, 2010

From @masak

<hudnix> rakudo​: class A {has $.a = $^b + 1;has $.b = $^a }; say A.new(1,2).a
<p6eval> rakudo 624188​: OUTPUT«Null PMC access in type() [...]
* masak submits rakudobug
<masak> rakudo​: class A { has $.a = $^b }; A.new
<p6eval> rakudo 624188​: OUTPUT«Null PMC access in isa_pmc() [...]

@p6rt
Copy link
Author

p6rt commented Oct 3, 2010

From @ashgti

std seems to complain that the placeholder variables are not valid here.
Maybe we need more clarification on whether this should work or not.

<ash_> std​: class A {has $.a = $^b + 1 }; say A.new(1).a

<p6eval> std 237d266​: OUTPUT«[31m===[0mSORRY![31m===[0m␤Placeholder variable
$^b may not be used here because the surrounding package block takes no
signature at /tmp/Fx9q_bkcz8 line 1​:␤------> [32mclass A {has $.a =
$^b[33m⏏[31m + 1}; say A.new(1).a

--
John Harrison

On Tue, Sep 28, 2010 at 5​:34 PM, Carl Mäsak <perl6-bugs-followup@​perl.org>wrote​:

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

<hudnix> rakudo​: class A {has $.a = $^b + 1;has $.b = $^a }; say
A.new(1,2).a
<p6eval> rakudo 624188​: OUTPUT«Null PMC access in type() [...]
* masak submits rakudobug
<masak> rakudo​: class A { has $.a = $^b }; A.new
<p6eval> rakudo 624188​: OUTPUT«Null PMC access in isa_pmc() [...]

@p6rt
Copy link
Author

p6rt commented Oct 3, 2010

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

@p6rt
Copy link
Author

p6rt commented Oct 4, 2010

From @masak

John (>)​:

std seems to complain that the placeholder variables are not valid here.
Maybe we need more clarification on whether this should work or not.

I'm fine with it being forbidden in this case. The ticket concerns the
presence of a Null PMC Access, which is always an error by virtue of
being an inadvertently exposed internal Parrot error.

@p6rt
Copy link
Author

p6rt commented Oct 8, 2011

From @coke

On Mon Oct 04 04​:13​:15 2010, masak wrote​:

John (>)​:

std seems to complain that the placeholder variables are not valid
here.
Maybe we need more clarification on whether this should work or not.

I'm fine with it being forbidden in this case. The ticket concerns the
presence of a Null PMC Access, which is always an error by virtue of
being an inadvertently exposed internal Parrot error.

Fixed, then​:

16​:56 < [Coke]> rakudo​: class A {has $.a = $^b + 1;has $.b = $^a }; say
  A.new(1,2).a
16​:56 <+p6eval> rakudo 88c5a5​: OUTPUT«Default constructor only takes
named
  arguments␤ in method new at src/gen/CORE.setting​:520␤
in
  block <anon> at /tmp/KlAxdogLlw​:1␤ in <anon> at
  /tmp/KlAxdogLlw​:1␤»
16​:56 < [Coke]> rakudo​: class A { has $.a = $^b }; A.new
16​:56 <+p6eval> rakudo 88c5a5​: OUTPUT«Cannot assign a non-Perl 6 value
to a
  Perl 6 container␤ in method BUILDALL at
  src/gen/CORE.setting​:542␤ in method bless at
  src/gen/CORE.setting​:532␤ in method new at
  src/gen/CORE.setting​:517␤ in block <anon> at
  /tmp/iSi_F7geIZ​:1␤ in <anon> at /tmp/iSi_F7geIZ​:1…

Closable with tests.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Mar 4, 2015

From @Mouq

Still a bug; I was able to get a segfault on MoarVM, and besides, Rakudo should give the same parse error that STD does​:

$ perl6 -e'use v6; class A {has $.a = $^b + 1;has $.b = $^a }; say A.new(a => 1).a'
Cannot assign a null value to a Perl 6 scalar
  in block at src/gen/m-CORE.setting​:1022
  in method BUILDALL at src/gen/m-CORE.setting​:977
  in method bless at src/gen/m-CORE.setting​:966
  in method new at src/gen/m-CORE.setting​:952
  in block <unit> at -e​:1

$ perl6 -e'use v6; class A {has $.a = $^b + 1;has $.b = $^a }; say A.new.a'
Segmentation fault
$ perl6 -v
This is perl6 version 2015.02-184-g0701960 built on MoarVM version 2015.02-25-g3d0404a

On Sat Oct 08 13​:57​:28 2011, coke wrote​:

On Mon Oct 04 04​:13​:15 2010, masak wrote​:

John (>)​:

std seems to complain that the placeholder variables are not valid
here.
Maybe we need more clarification on whether this should work or not.

I'm fine with it being forbidden in this case. The ticket concerns the
presence of a Null PMC Access, which is always an error by virtue of
being an inadvertently exposed internal Parrot error.

Fixed, then​:

16​:56 < [Coke]> rakudo​: class A {has $.a = $^b + 1;has $.b = $^a }; say
A.new(1,2).a
16​:56 <+p6eval> rakudo 88c5a5​: OUTPUT«Default constructor only takes
named
arguments␤ in method new at src/gen/CORE.setting​:520␤
in
block <anon> at /tmp/KlAxdogLlw​:1␤ in <anon> at
/tmp/KlAxdogLlw​:1␤»
16​:56 < [Coke]> rakudo​: class A { has $.a = $^b }; A.new
16​:56 <+p6eval> rakudo 88c5a5​: OUTPUT«Cannot assign a non-Perl 6 value
to a
Perl 6 container␤ in method BUILDALL at
src/gen/CORE.setting​:542␤ in method bless at
src/gen/CORE.setting​:532␤ in method new at
src/gen/CORE.setting​:517␤ in block <anon> at
/tmp/iSi_F7geIZ​:1␤ in <anon> at /tmp/iSi_F7geIZ​:1…

Closable with tests.

@p6rt
Copy link
Author

p6rt commented Apr 7, 2015

From @jnthn

On Tue Sep 28 15​:34​:07 2010, masak wrote​:

<hudnix> rakudo​: class A {has $.a = $^b + 1;has $.b = $^a }; say
A.new(1,2).a
<p6eval> rakudo 624188​: OUTPUT«Null PMC access in type() [...]
* masak submits rakudobug
<masak> rakudo​: class A { has $.a = $^b }; A.new
<p6eval> rakudo 624188​: OUTPUT«Null PMC access in isa_pmc() [...]

Fixed to detect the illegal placeholder usage, and tested in S32-exceptions/misc.t.

@p6rt
Copy link
Author

p6rt commented Apr 7, 2015

@jnthn - 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