Yes, this feels like natural Raku code to a lot of us:

    given any( $o1, $o2 ) { when <pattern> { ... } }

If there's some rule like, "don't use junctions
on the left hand side of a smartmatch" that
hasn't been made clear, and there's certainly no
roast tests that check this, so consequently the
behavior has drifted around.

The latest word from Jonathan Worthington seems
to be that the current behavior should probably
be reverted *for now*, but a later language
version of Raku will change it again, albeit more
consistently.

So if you were serious about writing Raku code
(and not just playing around with it, as I mostly am)
you'd need to have a list in mind of these things
that are kinda-sorta-deprecated. Otherwise, you'd
just have to expect breakage on upgrade in the future.


On 11/4/21, yary <not....@gmail.com> wrote:
> and I realize that what I just typed doesn't help a whole lot, what if you
> have a junction of things and you want to tell if any/one/all/none
> smartmatch the same thing... OK..
>
> -y
>
>
> On Thu, Nov 4, 2021 at 6:38 PM yary <not....@gmail.com> wrote:
>
>> Something that helps me reason about this is thinking of how regular
>> expressions match against strings, to remember that which goes on which
>> side is important...
>>
>> > "this has a Q in it" ~~ / 'Q' /  # of course this works
>>
>> 「Q」
>>
>> > / 'Q' / ~~ "this has a Q in it" # of course this breaks
>>
>> Regex object coerced to string ...
>>
>>
>> > say do given "this has a Q in it" { when / 'Q' / {"has a Q"}; default
>> {"no match"}}
>>
>> has a Q
>>
>> > say do given / 'Q' / { when "this has a Q in it" {"has a Q"}; default
>> {"no match"}}
>>
>> Regex object coerced to string ...
>>
>> I did have a place in the earlier discussion. I eventually realized that
>> if I thought of junctions as analogous to regular expressions, then it
>> was
>> easier to remember which side of the smartmatch or given/when to put it.
>>
>> -y
>>
>>
>> On Thu, Nov 4, 2021 at 3:31 PM Joseph Brenner <doom...@gmail.com> wrote:
>>
>>> > ... we'd need to go
>>> > through detailed, calm, measured discussion if we're to minimize
>>> > the pain it seems we'll inevitably endure pain to dig ourselves out
>>> > of the hole we'd be in.
>>>
>>> Yes, this could be a bad one.
>>>
>>
>

Reply via email to