develooper Front page | perl.perl6.users | Postings from May 2021

Re: What's going on with "given (junction) {when (value)...}"

Thread Previous | Thread Next
From:
yary
Date:
May 31, 2021 17:00
Subject:
Re: What's going on with "given (junction) {when (value)...}"
Message ID:
CAG2CFAYdY6OBEFoMB2b9joqpvOd7_9mfv5ZRVuA5J1VxpQvYvQ@mail.gmail.com
Nice checking! I opened https://github.com/rakudo/rakudo/issues/4386
-y


On Mon, May 31, 2021 at 3:45 AM Bruce Gray <robertbrucegray3@gmail.com>
wrote:

>
>
> > On May 30, 2021, at 9:18 PM, yary <not.com@gmail.com> wrote:
> >
> > This came up in today's Raku study group (my own golfing-)
> >
> > > ? (any(4,3) ~~ 3)
> > True
> > > ? (3 ~~ any(4,3))
> > True
> > > given any(4,3) { when 3 {say '3'}; say 'nope'}
> > nope
> > > given 3 { when any(4,3) {say '3'}; say 'nope'}
> > 3
> > > given any(4,3) { say .raku }
> > any(4, 3)
> >
> > why does Raku say 'nope' for the example "given any(4,3) { when 3 {say
> '3'}; say 'nope'}"
> >
> > Since this expression is true ? (any(4,3) ~~ 3)
> > I expected the "given 4|3" to also match "when 3"
> >
> > -y
>
> This looks very version dependent, and I would not have expected it to be
> version dependent at all.
>
> Summary of behavior across versions. True means `given any(4,3) { when
> 3...` does match just like its converse, and False means it does not match.
> I have noted possible false negatives; 3 of the docker build have MoarVM
> versions newer than the Rakudo versions. Possible build error?
>         False 2020.[1..2] (But suspect, since the VM reported version
> 2020.12)
>         True  2020.[5..9]
>         False 2020.10     (But suspect, since the VM reported version
> 2020.12)
>         True  2020.11
>         False 2020.12 through nightly (which was 4 hours ago)
>
> Full detail:
> (All run on JJ's alpine docker images (Thanks JJ!), but on a Windows box
> (hence the double-quotes), because Docker is hosed on my Macbook.)
> C:\Users\bruce>copy con yary_03.bat
> @echo off
> docker run --rm -it jjmerelo/alpine-raku:2020.01     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2020.02     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2020.05     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2020.05.1   -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2020.06     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2020.07     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2020.08     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2020.08.1   -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2020.08.2   -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2020.09     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2020.10     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2020.11     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2020.12     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2021.02     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2021.02.1   -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2021.03     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2021.04     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:2021.05     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:latest      -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> docker run --rm -it jjmerelo/alpine-raku:nightly     -e "print
> $*VM.version; given any(4,3) { when 3 {say True}; say False; };"
> ^Z
>         1 file(s) copied.
>
> C:\Users\bruce>yary_03.bat
> 2020.12False
> 2020.12False
> 2020.05True
> 2020.05True
> 2020.06True
> 2020.07True
> 2020.07.16.g.03.d.3.e.43.faTrue
> 2020.08True
> 2020.08True
> 2020.09True
> 2020.12False
> 2020.11True
> 2020.12False
> 2021.02False
> 2021.02False
> 2021.03False
> 2021.04False
> 2021.05False
> 2021.05False
> 2021.05False
>
>
> In https://github.com/MoarVM/MoarVM/blob/master/docs/ChangeLog , I see
> nothing in 2020.11 that looks like the culprit.
> In https://github.com/rakudo/rakudo/blob/master/docs/ChangeLog , I see
> nothing in 2020.11 that looks like the culprit, but that big change in
> coersion ("new coertion semantics”) was big enough to make that a good
> candidate for proper bisecting.
> (but not by me; I am out of time for this week)
>
> —
> Hope this helps,
> Bruce Gray (Util of PerlMonks)
>
>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About