Skip Menu |
Report information
Id: 78676
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: FROGGS.de <email [at] froggs.de>
masak <cmasak [at] gmail.com>
moritz <moritz.lenz+perl [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Regression in Parent{ :attribute<value> } initialization
Date: Tue, 13 Jul 2010 18:59:40 +0200
To: rakudobug [...] perl.org
From: Moritz Lenz <moritz [...] faui2k3.org>
Download (untitled) / with headers
text/plain 154b
In the course of the 'ng' branch, Rakudo has regressed on passing parent attributes to constructors. Tests can be found in t/spec/S12-construction/new.t
Subject: [BUG] Using the special ClassName{ :key($value) } syntax inside .new doesn't work in Rakudo
Date: Thu, 28 Oct 2010 23:40:42 +0200
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 728b
<masak> rakudo: class A { has $.x; method foo { say $!x } }; class B is A { has $.x; method bar { say $!x } }; B.new(:x(42), A{ :x(5) }) <p6eval> rakudo 479650: OUTPUT«flattened parameters must be a hash or array [...] <masak> jnthn: whoz op with that? <jnthn> rakudo: class A { }; class B { }; B.new(A{ :x(5) }) <p6eval> rakudo 479650: OUTPUT«flattened parameters must be a hash or array [...] <jnthn> Hm <jnthn> masak: Off hand, I'm not sure. <jnthn> masak: Unless it's a general WHENCE issue. <masak> but it's a bug, right? <jnthn> Yeah * masak submits rakudobug <jnthn> I wonder if we're missing A{ ... } support somehow. <masak> I'm pretty sure it worked at some point. <masak> not sure it ever worked in master, though.
Subject: [BUG] Can't instantiate an object setting values of parent classes' attributes in Rakudo
Date: Sat, 1 Jan 2011 17:43:13 +0100
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 675b
<masak> rakudo: class A { has $.val }; class B is A { has $.val }; my $b = B.new(A{ :val("A") }); say "alive" <p6eval> rakudo b570a2: OUTPUT«flattened parameters must be a hash or array␤ in main program body at line 22:/tmp/DYw5OTlNCI␤» <masak> this should work, no? <masak> I think it even used to... <masak> alpha: class A { has $.val }; class B is A { has $.val }; my $b = B.new(A{ :val("A") }); say $b.A::val <p6eval> alpha : OUTPUT«Use of uninitialized value␤␤» * masak submits rakudobug alpha didn't get the accessor right, but it parses the constructor syntax without a problem. There are spectests for this in S12-construction/new.t, but they're TODO'd.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 925b
On Thu Oct 28 14:41:06 2010, masak wrote: Show quoted text
> <masak> rakudo: class A { has $.x; method foo { say $!x } }; class B > is A { has $.x; method bar { say $!x } }; B.new(:x(42), A{ :x(5) }) > <p6eval> rakudo 479650: OUTPUT«flattened parameters must be a hash or > array [...] > <masak> jnthn: whoz op with that? > <jnthn> rakudo: class A { }; class B { }; B.new(A{ :x(5) }) > <p6eval> rakudo 479650: OUTPUT«flattened parameters must be a hash or > array [...] > <jnthn> Hm > <jnthn> masak: Off hand, I'm not sure. > <jnthn> masak: Unless it's a general WHENCE issue. > <masak> but it's a bug, right? > <jnthn> Yeah > * masak submits rakudobug > <jnthn> I wonder if we're missing A{ ... } support somehow. > <masak> I'm pretty sure it worked at some point. > <masak> not sure it ever worked in master, though.
This now dies with: Default constructor for 'B' only takes named arguments Is this acceptable? -- Will "Coke" Coleda
From: Carl Mäsak <cmasak [...] gmail.com>
Date: Wed, 26 Feb 2014 09:08:52 +0100
To: "perl6-bugs-followup [...] perl.org" <perl6-bugs-followup [...] perl.org>
Subject: Re: [perl #78676] [BUG] Using the special ClassName{ :key($value) } syntax inside .new doesn't work in Rakudo
CC: "perl6-compiler [...] perl.org" <perl6-compiler [...] perl.org>
Download (untitled) / with headers
text/plain 1.1k
On Wed, Feb 26, 2014 at 1:50 AM, Will Coleda via RT <perl6-bugs-followup@perl.org> wrote: Show quoted text
> On Thu Oct 28 14:41:06 2010, masak wrote:
>> <masak> rakudo: class A { has $.x; method foo { say $!x } }; class B >> is A { has $.x; method bar { say $!x } }; B.new(:x(42), A{ :x(5) }) >> <p6eval> rakudo 479650: OUTPUT«flattened parameters must be a hash or >> array [...] >> <masak> jnthn: whoz op with that? >> <jnthn> rakudo: class A { }; class B { }; B.new(A{ :x(5) }) >> <p6eval> rakudo 479650: OUTPUT«flattened parameters must be a hash or >> array [...] >> <jnthn> Hm >> <jnthn> masak: Off hand, I'm not sure. >> <jnthn> masak: Unless it's a general WHENCE issue. >> <masak> but it's a bug, right? >> <jnthn> Yeah >> * masak submits rakudobug >> <jnthn> I wonder if we're missing A{ ... } support somehow. >> <masak> I'm pretty sure it worked at some point. >> <masak> not sure it ever worked in master, though.
> > This now dies with: > > Default constructor for 'B' only takes named arguments > > Is this acceptable?
It shouldn't die, it should be a legal way to construct a B object with an assignment to the (shadowed) $!x in A.
Subject: [BUG] cannot set parent's class attributes in constructor
Download (untitled) / with headers
text/plain 402b
class Foo { has $.x is rw }; class Bar is Foo { }; my Foo $u .= new(:5x); say $u.x; $u = Bar.new(Foo{:12x}); rakudo-moar a34d02: OUTPUT«5␤Default constructor for 'Bar' only takes named arguments␤ in block <unit> at /tmp/FrBrn8xOI_:1␤␤» I guess this needs to translate to something else than Any in order to make it work: class Foo { }; say (Foo{:12x}) rakudo-moar a34d02: OUTPUT«(Any)␤»
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 752b
On Thu May 07 02:51:39 2015, FROGGS.de wrote: Show quoted text
> class Foo { has $.x is rw }; class Bar is Foo { }; my Foo $u .= > new(:5x); say $u.x; $u = Bar.new(Foo{:12x}); > rakudo-moar a34d02: OUTPUT«5␤Default constructor for 'Bar' only takes > named arguments␤ in block <unit> at /tmp/FrBrn8xOI_:1␤␤» > > I guess this needs to translate to something else than Any in order to > make it work: > class Foo { }; say (Foo{:12x}) > rakudo-moar a34d02: OUTPUT«(Any)␤»
We actually weren't recognizing the auto-vivifying closure syntax at all. I've now reserved it, so we can implement this feature in a future version of the Perl 6 language. It's not being missed too hard, and I don't want to rush in a half-baked implementation of it for 6.Christmas.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org