On Mon Sep 12 15:04:09 2011, masak wrote:
> <masak> b: my @a = [1], [2], [3]; say (map { @a[1 - $_][0] }, 0 ..
> 3).perl
> <p6eval> b 1b7dd1: OUTPUT«(2, 1, Any, Any)␤»
> <masak> nom: my @a = [1], [2], [3]; say (map { @a[1 - $_][0] }, 0 ..
> 3).perl
> <p6eval> nom 08ef94: OUTPUT«(2, 1).list␤»
> * masak submits rakudobug
> <tadzik> here we go again
> <masak> tadzik: this change in semantics causes connect-4 to give the
> first player the win on the first move.
> <tadzik> masak: serious business
> <masak> tadzik: seems connect-4's winning condition relied on being
> able to do negative indexing.
> <masak> tadzik: I have no trouble believing that this isn't
> spectested.
> <masak> and I have no horse in this race. I'll gladly rewrite that
> part of connect-4 if need be.
> <masak> but until there's a verdict, it goes into RT.
> <masak> niecza: my @a = [1], [2], [3]; say (map { @a[1 - $_][0] }, 0
> .. 3).perl
> <p6eval> niecza v9-23-g1a8efca: OUTPUT«(2, 1, Any, Any).list␤»
> [23:52]
> <masak> there'a another data point, I guess.
> <jnthn> nom: my @a = [1], [2], [3]; say (map { say @a[1 - $_][0].WHAT;
> @a[1 - $_][0] }, 0 .. 3).perl
> <p6eval> nom 08ef94: OUTPUT«Int()␤Int()␤Nil␤Nil␤(2, 1).list␤»
> <jnthn> nom: say (map { Nil }, 0 .. 3).perl
> <p6eval> nom 08ef94: OUTPUT«().list␤»
> <jnthn> masak: There's the underlying thing.
> <masak> jnthn: I suspected that.
> <masak> jnthn: why Nil and not Any?
> <jnthn> masak: I can believe that's actually correct. But I'm not
> quite sure if the Nil you got before is wrong.
> <jnthn> masak: That is, it's not map's fault..but @a[1 - $_][0]
> returning Nil may be wrong.
> <masak> aye.
> <masak> I know.
> <jnthn> Well, so that golfs if. :)
> 
> Does the spec say that one should get Nil in this case? I was fine
> with getting Any. Note also that Niecza agrees.

These days, it fails.

<masak> rn: my @a = [1], [2], [3]; say (map { @a[1 - $_][0] }, 0 .. 
3).perl
<camelia> niecza v24-95-ga6d4c5f: OUTPUT«(2, 1, Any, Any).list␤»
<camelia> ..rakudo 69c3cc: OUTPUT«(2, 1, Failure.new(exception => 
X::AdHoc.new(payload => "Cannot use negative index -1 on Array")), 
Failure.new(exception => X::AdHoc.new(payload => "Cannot use negative 
index -2 on Array"))).list␤»
* masak amends RT #98954

Which is arguably more correct than silently truncating the result list. 
(But still different from both Beijing and Niecza.)

Reply via email to