develooper Front page | perl.perl6.users | Postings from July 2022

Confused after consuming hashish

Thread Next
From:
rir
Date:
July 7, 2022 02:54
Subject:
Confused after consuming hashish
Message ID:
20220707025411.voqzi47i3xaohlzx@shrew

This is sharing a 'What?!!' moment and some aftermath with the
hope of some reduction of ignorance.

This is from some code I found:

    say my %h = % = %(:a(1));       # OUTPUT: «{a => 1}␤»

All whitespace after the identifier is optional--not changing the
assignment.

Reduced further:

    say % = %(:a(1));              # OUTPUT: «{a => 1}␤»

I don't know what the free-standing '%' means; my guess is that
it accepts the result of the assign-op as a term.  So it is the
same as the last '%'.

Is that correct?  Correct as Raku code and as what is happening.

Why, in the ' %= ' variant, is neither of these failing?
Is it not ambiguous with the '%=' operator?

And I found that '%=' is also indexed in the docs as a twigil,
but it is not in the docs.  Is i



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