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

@x and @.x in class methods treated differently #1758

Closed
p6rt opened this issue May 10, 2010 · 6 comments
Closed

@x and @.x in class methods treated differently #1758

p6rt opened this issue May 10, 2010 · 6 comments

Comments

@p6rt
Copy link

p6rt commented May 10, 2010

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

Searchable as RT75010$

@p6rt
Copy link
Author

p6rt commented May 10, 2010

From @finanalyst

See IRC May 10
@​.x[1 .. +@​x] is not being treated (rakudo dies) in the same way as @​y[1
.. +@​y]

In particular​:

finanalyst​: rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
@​y[1 .. +@​y]; .say for @​.x; .say for @​.x[1 ..^ +@​.x] } };my AB $y
.=new(​:x(1,2,3)); $y.aa;
p6eval​: rakudo 3d3893​: OUTPUT«2␤3␤␤1␤2␤3␤No applicable candidates found
to dispatch to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu :
Int $i;; *%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»

More detail​:

finanalyst​: rakudo​: my @​x=1,2,3,4; .say for @​x[1 ..^ +@​x]
p6eval​: rakudo 3d3893​: OUTPUT«2␤3␤4␤»
finanalyst​: works
finanalyst​: rakudo​: class AB{has @​.x; method aa { .say for @​.x; .say for
@​.x[1 ..^ +@​.x] } };my AB $y .=new(​:x(1,2,3)); $y.aa;
p6eval​: rakudo 3d3893​: OUTPUT«1␤2␤3␤No applicable candidates found to
dispatch to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu :
Int $i;; *%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»
finanalyst​: doesnt work
masak​: that is indeed odd.
colomon​: ah, I believe that's an array-handling bug.
moritz_​: seems like @​.x is not the same kind of array as @​x
moritz_​: rakudo​: class A { has @​.x }; say A.new(​:x[1, 2, 3]).x.WHAT
p6eval​: rakudo 3d3893​: OUTPUT«Array()␤»
colomon​: ran into this same sort of problem passing @​x as an argument.
moritz_​: rakudo​: class A { has @​.x }; say A.new(​:x[1, 2, 3]).x.PARROT
p6eval​: rakudo 3d3893​: OUTPUT«Array␤»
finanalyst​: rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
@​y; .say for @​.x; .say for @​.x[1 ..^ +@​.x] } };my AB $y
.=new(​:x(1,2,3)); $y.aa;
p6eval​: rakudo 3d3893​: OUTPUT«1␤2␤3␤1␤2␤3␤No applicable candidates found
to dispatch to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu :
Int $i;; *%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»
masak​: rakudo​: class A { has @​.x }; say A.new(​:x(1, 2, 3)).x.WHAT
p6eval​: rakudo 3d3893​: OUTPUT«Array()␤»
finanalyst​: rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
@​y[1 .. +@​y]; .say for @​.x; .say for @​.x[1 ..^ +@​.x] } };my AB $y
.=new(​:x(1,2,3)); $y.aa;
p6eval​: rakudo 3d3893​: OUTPUT«2␤3␤␤1␤2␤3␤No applicable candidates found
to dispatch to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu :
Int $i;; *%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»
finanalyst​: definitely treating @​y and @​.x differently
moritz_​: rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
@​!x[1..^+@​!x] } }; AB.new(​:x[1, 2, 3]).aa
p6eval​: rakudo 3d3893​: OUTPUT«No applicable candidates found to dispatch
to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu : Int $i;;
*%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»
- envi^home has joined the room
colomon​: rakudo​: sub foo(@​a) { .say for @​a[1 ..^ +@​a] }; my @​a = 1... 4;
foo(@​a)
p6eval​: rakudo 3d3893​: OUTPUT«2␤3␤4␤»

- 18​:25 -
colomon​: hmmm....
finanalyst​: shall i post a rakudobug?
* colomon still thinks it's related to a rakudobug from a couple of
weeks ago...
colomon​: finanalyst​: yes.

@p6rt
Copy link
Author

p6rt commented Jan 11, 2012

From @coke

On Mon May 10 07​:31​:39 2010, richardh wrote​:

See IRC May 10
@​.x[1 .. +@​x] is not being treated (rakudo dies) in the same way as @​y[1
.. +@​y]

In particular​:

finanalyst​: rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
@​y[1 .. +@​y]; .say for @​.x; .say for @​.x[1 ..^ +@​.x] } };my AB $y
.=new(​:x(1,2,3)); $y.aa;
p6eval​: rakudo 3d3893​: OUTPUT«2␤3␤␤1␤2␤3␤No applicable candidates found
to dispatch to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu :
Int $i;; *%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»

This now says​:

20​:02 < [Coke]> rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
  @​y[1 .. +@​y]; .say for @​.x; .say for @​.x[1 ..^ +@​.x] } };my AB
  $y.=new(​:x(1,2,3)); $y.aa;
20​:02 <+p6eval> rakudo 38165a​: OUTPUT«2␤3␤Any()␤1␤2␤3␤2␤3␤»

Is this correct and closable?

More detail​:

finanalyst​: rakudo​: my @​x=1,2,3,4; .say for @​x[1 ..^ +@​x]
p6eval​: rakudo 3d3893​: OUTPUT«2␤3␤4␤»
finanalyst​: works
finanalyst​: rakudo​: class AB{has @​.x; method aa { .say for @​.x; .say for
@​.x[1 ..^ +@​.x] } };my AB $y .=new(​:x(1,2,3)); $y.aa;
p6eval​: rakudo 3d3893​: OUTPUT«1␤2␤3␤No applicable candidates found to
dispatch to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu :
Int $i;; *%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»
finanalyst​: doesnt work
masak​: that is indeed odd.
colomon​: ah, I believe that's an array-handling bug.
moritz_​: seems like @​.x is not the same kind of array as @​x
moritz_​: rakudo​: class A { has @​.x }; say A.new(​:x[1, 2, 3]).x.WHAT
p6eval​: rakudo 3d3893​: OUTPUT«Array()␤»
colomon​: ran into this same sort of problem passing @​x as an argument.
moritz_​: rakudo​: class A { has @​.x }; say A.new(​:x[1, 2, 3]).x.PARROT
p6eval​: rakudo 3d3893​: OUTPUT«Array␤»
finanalyst​: rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
@​y; .say for @​.x; .say for @​.x[1 ..^ +@​.x] } };my AB $y
.=new(​:x(1,2,3)); $y.aa;
p6eval​: rakudo 3d3893​: OUTPUT«1␤2␤3␤1␤2␤3␤No applicable candidates found
to dispatch to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu :
Int $i;; *%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»
masak​: rakudo​: class A { has @​.x }; say A.new(​:x(1, 2, 3)).x.WHAT
p6eval​: rakudo 3d3893​: OUTPUT«Array()␤»
finanalyst​: rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
@​y[1 .. +@​y]; .say for @​.x; .say for @​.x[1 ..^ +@​.x] } };my AB $y
.=new(​:x(1,2,3)); $y.aa;
p6eval​: rakudo 3d3893​: OUTPUT«2␤3␤␤1␤2␤3␤No applicable candidates found
to dispatch to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu :
Int $i;; *%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»
finanalyst​: definitely treating @​y and @​.x differently
moritz_​: rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
@​!x[1..^+@​!x] } }; AB.new(​:x[1, 2, 3]).aa
p6eval​: rakudo 3d3893​: OUTPUT«No applicable candidates found to dispatch
to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu : Int $i;;
*%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»
- envi^home has joined the room
colomon​: rakudo​: sub foo(@​a) { .say for @​a[1 ..^ +@​a] }; my @​a = 1... 4;
foo(@​a)
p6eval​: rakudo 3d3893​: OUTPUT«2␤3␤4␤»

- 18​:25 -
colomon​: hmmm....
finanalyst​: shall i post a rakudobug?
* colomon still thinks it's related to a rakudobug from a couple of
weeks ago...
colomon​: finanalyst​: yes.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jan 11, 2012

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

@p6rt
Copy link
Author

p6rt commented Jan 11, 2012

From @finanalyst

Will,

This appears to be the expected output.

Richard

On 01/11/2012 05​:04 AM, Will Coleda via RT wrote​:

On Mon May 10 07​:31​:39 2010, richardh wrote​:

See IRC May 10
@​.x[1 .. +@​x] is not being treated (rakudo dies) in the same way as @​y[1
.. +@​y]

In particular​:

finanalyst​: rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
@​y[1 .. +@​y]; .say for @​.x; .say for @​.x[1 ..^ +@​.x] } };my AB $y
.=new(​:x(1,2,3)); $y.aa;
p6eval​: rakudo 3d3893​: OUTPUT«2␤3␤␤1␤2␤3␤No applicable candidates found
to dispatch to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu :
Int $i;; *%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»
This now says​:

20​:02< [Coke]> rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
@​y[1 .. +@​y]; .say for @​.x; .say for @​.x[1 ..^ +@​.x] } };my AB
$y.=new(​:x(1,2,3)); $y.aa;
20​:02<+p6eval> rakudo 38165a​: OUTPUT«2␤3␤Any()␤1␤2␤3␤2␤3␤»

Is this correct and closable?

More detail​:

finanalyst​: rakudo​: my @​x=1,2,3,4; .say for @​x[1 ..^ +@​x]
p6eval​: rakudo 3d3893​: OUTPUT«2␤3␤4␤»
finanalyst​: works
finanalyst​: rakudo​: class AB{has @​.x; method aa { .say for @​.x; .say for
@​.x[1 ..^ +@​.x] } };my AB $y .=new(​:x(1,2,3)); $y.aa;
p6eval​: rakudo 3d3893​: OUTPUT«1␤2␤3␤No applicable candidates found to
dispatch to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu :
Int $i;; *%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»
finanalyst​: doesnt work
masak​: that is indeed odd.
colomon​: ah, I believe that's an array-handling bug.
moritz_​: seems like @​.x is not the same kind of array as @​x
moritz_​: rakudo​: class A { has @​.x }; say A.new(​:x[1, 2, 3]).x.WHAT
p6eval​: rakudo 3d3893​: OUTPUT«Array()␤»
colomon​: ran into this same sort of problem passing @​x as an argument.
moritz_​: rakudo​: class A { has @​.x }; say A.new(​:x[1, 2, 3]).x.PARROT
p6eval​: rakudo 3d3893​: OUTPUT«Array␤»
finanalyst​: rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
@​y; .say for @​.x; .say for @​.x[1 ..^ +@​.x] } };my AB $y
.=new(​:x(1,2,3)); $y.aa;
p6eval​: rakudo 3d3893​: OUTPUT«1␤2␤3␤1␤2␤3␤No applicable candidates found
to dispatch to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu :
Int $i;; *%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»
masak​: rakudo​: class A { has @​.x }; say A.new(​:x(1, 2, 3)).x.WHAT
p6eval​: rakudo 3d3893​: OUTPUT«Array()␤»
finanalyst​: rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
@​y[1 .. +@​y]; .say for @​.x; .say for @​.x[1 ..^ +@​.x] } };my AB $y
.=new(​:x(1,2,3)); $y.aa;
p6eval​: rakudo 3d3893​: OUTPUT«2␤3␤␤1␤2␤3␤No applicable candidates found
to dispatch to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu :
Int $i;; *%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»
finanalyst​: definitely treating @​y and @​.x differently
moritz_​: rakudo​: class AB{has @​.x; method aa { my @​y=1,2,3; .say for
@​!x[1..^+@​!x] } }; AB.new(​:x[1, 2, 3]).aa
p6eval​: rakudo 3d3893​: OUTPUT«No applicable candidates found to dispatch
to for 'postcircumfix​:<[ ]>'. Available candidates are​:␤Mu : Int $i;;
*%_)␤Mu : Block $b;; *%_)␤Mu : !whatever_dispatch_helper ;;
*%_)␤␤current instr.​: '!postcircumfix​:<[ ]>' pc 11329
(src/builtins/Role.pir​:26)␤»
- envi^home has joined the room
colomon​: rakudo​: sub foo(@​a) { .say for @​a[1 ..^ +@​a] }; my @​a = 1... 4;
foo(@​a)
p6eval​: rakudo 3d3893​: OUTPUT«2␤3␤4␤»

- 18​:25 -
colomon​: hmmm....
finanalyst​: shall i post a rakudobug?
* colomon still thinks it's related to a rakudobug from a couple of
weeks ago...
colomon​: finanalyst​: yes.

@p6rt
Copy link
Author

p6rt commented Aug 11, 2013

From @moritz

Now tested in t/spec/S12-class/attributes.t

@p6rt
Copy link
Author

p6rt commented Aug 11, 2013

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

No branches or pull requests

1 participant