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

natively typed attributes and BUILD methods don't mix #2566

Closed
p6rt opened this issue Nov 30, 2011 · 9 comments
Closed

natively typed attributes and BUILD methods don't mix #2566

p6rt opened this issue Nov 30, 2011 · 9 comments

Comments

@p6rt
Copy link

p6rt commented Nov 30, 2011

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

Searchable as RT104980$

@p6rt
Copy link
Author

p6rt commented Nov 30, 2011

From @moritz

14​:44 < moritz> nom​: class A { has str $.x; method BUILD(​:$!x) { } };
say A.new(​:x<foo>).x
14​:44 <+p6eval> nom ff7fd2​: OUTPUT«Cannot assign to a non-container␤ in
method BUILD at /tmp/rmcjzlnZkz​:1␤ in method BUILDALL at
  src/gen/CORE.setting​:568␤ in method bless at
  src/gen/CORE.setting​:558␤ in method new at
  src/gen/CORE.setting​:543␤ in block <anon> at
  /tmp/rmcjzlnZkz​:1␤ in <anon> at /tm…

@p6rt
Copy link
Author

p6rt commented Mar 1, 2015

From @usev6

As a status update​: This currently fails with​:

$ perl6-m -e 'class A { has str $.x; method BUILD(​:$!x) { } }; say A.new(​:x<foo>).x'
Cannot modify an immutable str
  in method BUILD at -e​:1
  in method BUILDALL at src/gen/m-CORE.setting​:983
  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-j -e 'class A { has str $.x; method BUILD(​:$!x) { } }; say A.new(​:x<foo>).x'
java.lang.RuntimeException​: Cannot access a native attribute as a reference attribute
  in method BUILD at -e​:1
  in method BUILDALL at gen/jvm/CORE.setting​:965
  in method bless at gen/jvm/CORE.setting​:948
  in method new at gen/jvm/CORE.setting​:934
  in block <unit> at -e​:1

$ perl6-m --version
This is perl6 version 2015.02-151-g669f482 built on MoarVM version 2015.02-17-g86d0c68

1 similar comment
@p6rt
Copy link
Author

p6rt commented Mar 1, 2015

From @usev6

As a status update​: This currently fails with​:

$ perl6-m -e 'class A { has str $.x; method BUILD(​:$!x) { } }; say A.new(​:x<foo>).x'
Cannot modify an immutable str
  in method BUILD at -e​:1
  in method BUILDALL at src/gen/m-CORE.setting​:983
  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-j -e 'class A { has str $.x; method BUILD(​:$!x) { } }; say A.new(​:x<foo>).x'
java.lang.RuntimeException​: Cannot access a native attribute as a reference attribute
  in method BUILD at -e​:1
  in method BUILDALL at gen/jvm/CORE.setting​:965
  in method bless at gen/jvm/CORE.setting​:948
  in method new at gen/jvm/CORE.setting​:934
  in block <unit> at -e​:1

$ perl6-m --version
This is perl6 version 2015.02-151-g669f482 built on MoarVM version 2015.02-17-g86d0c68

@p6rt
Copy link
Author

p6rt commented Mar 1, 2015

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

@p6rt
Copy link
Author

p6rt commented Sep 22, 2017

From @skids

On Sun, 01 Mar 2015 12​:29​:14 -0800, bartolin@​gmx.de wrote​:

As a status update​: This currently fails with​:

$ perl6-m -e 'class A { has str $.x; method BUILD(​:$!x) { } }; say
A.new(​:x<foo>).x'
Cannot modify an immutable str
in method BUILD at -e​:1
in method BUILDALL at src/gen/m-CORE.setting​:983
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-j -e 'class A { has str $.x; method BUILD(​:$!x) { } }; say
A.new(​:x<foo>).x'
java.lang.RuntimeException​: Cannot access a native attribute as a
reference attribute
in method BUILD at -e​:1
in method BUILDALL at gen/jvm/CORE.setting​:965
in method bless at gen/jvm/CORE.setting​:948
in method new at gen/jvm/CORE.setting​:934
in block <unit> at -e​:1

$ perl6-m --version
This is perl6 version 2015.02-151-g669f482 built on MoarVM version
2015.02-17-g86d0c68

Current behavior (don't have a rakudo-j here)​:

$ perl6-m -e 'class A { has str $.x; method BUILD(​:$!x) { } }; say A.new(​:x<foo>).x'
foo

If r-j now works too, we can move to TESTNEEDED.

@p6rt
Copy link
Author

p6rt commented Sep 22, 2017

From @usev6

On Thu, 21 Sep 2017 19​:50​:01 -0700, bri@​abrij.org wrote​:

Current behavior (don't have a rakudo-j here)​:

$ perl6-m -e 'class A { has str $.x; method BUILD(​:$!x) { } }; say
A.new(​:x<foo>).x'
foo

If r-j now works too, we can move to TESTNEEDED.

Yeah, looks good on rakudo-j, too​:

$ ./perl6-j -e 'class A { has str $.x; method BUILD(​:$!x) { } }; say A.new(​:x<foo>).x'
foo

I'm marking the isse as TESTNEEDED.

@p6rt
Copy link
Author

p6rt commented Sep 22, 2017

From @skids

On Thu, 21 Sep 2017 22​:56​:20 -0700, bartolin@​gmx.de wrote​:

On Thu, 21 Sep 2017 19​:50​:01 -0700, bri@​abrij.org wrote​:

Current behavior (don't have a rakudo-j here)​:

$ perl6-m -e 'class A { has str $.x; method BUILD(​:$!x) { } }; say
A.new(​:x<foo>).x'
foo

If r-j now works too, we can move to TESTNEEDED.

Yeah, looks good on rakudo-j, too​:

$ ./perl6-j -e 'class A { has str $.x; method BUILD(​:$!x) { } }; say
A.new(​:x<foo>).x'
foo

I'm marking the isse as TESTNEEDED.

Tests added in roast commit d06b0a230, so resolving

@p6rt
Copy link
Author

p6rt commented Sep 22, 2017

From @skids

On Fri, 22 Sep 2017 16​:25​:28 -0700, bri@​abrij.org wrote​:

On Thu, 21 Sep 2017 22​:56​:20 -0700, bartolin@​gmx.de wrote​:

On Thu, 21 Sep 2017 19​:50​:01 -0700, bri@​abrij.org wrote​:

Current behavior (don't have a rakudo-j here)​:

$ perl6-m -e 'class A { has str $.x; method BUILD(​:$!x) { } }; say
A.new(​:x<foo>).x'
foo

If r-j now works too, we can move to TESTNEEDED.

Yeah, looks good on rakudo-j, too​:

$ ./perl6-j -e 'class A { has str $.x; method BUILD(​:$!x) { } }; say
A.new(​:x<foo>).x'
foo

I'm marking the isse as TESTNEEDED.

Tests added in roast commit d06b0a230, so resolving

Actually selecting "resolved" from the dropdown this time :-)

@p6rt
Copy link
Author

p6rt commented Sep 22, 2017

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

@p6rt p6rt closed this as completed Sep 22, 2017
@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