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«23123No 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«23Any()12323»
Is this correct and closable?
More detail:
finanalyst: rakudo: my @x=1,2,3,4; .say for @x[1 ..^ +@x]
p6eval: rakudo 3d3893: OUTPUT«234»
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«123No 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«123123No 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«23123No 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«234»
- 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.