Re: colon pair confusion
[email protected] (ToddAndMargo via perl6-users) Tue, 18 Nov 2025 23:53:44 -0800
| Newsgroups | perl.perl6.users |
|---|---|
| Message-ID | <[email protected]> |
>> On Tue, Nov 18, 2025 at 9:45 PM ToddAndMargo via perl6-users <perl6- >> [email protected] <mailto:[email protected]>> wrote: >> >> Hi All, >> >> I am a bit confused as to what colon pairs are actually doing: >> >> [0] > my $y=:abc; >> abc => True >> Why is this True and not Nil? >> >> >> [1] > my $y=:abc(123); >> abc => 123 >> This I get. >> >> >> [2] > my $y=:abc(); >> abc => () >> Why is this () and not Nil? >> >> >> [3] > my $y=:abc(Nil); >> abc => Nil >> This I get >> >> >> Yours in Confusion, >> -T >> On 11/18/25 11:29 PM, Sean McAfee wrote: > It's all spelled out here: https://docs.raku.org/language/ > glossary#Adverbial_pair <https://docs.raku.org/language/ > glossary#Adverbial_pair> > > Notice in particular that :foo means :foo(True) and :!foo > means :foo(False). Also see that > > [...] other circumfix operators with their usual semantics can be used > for stating the value, e.g. |:foo[…]| for an array and |:foo{…}| for a > hash or even a |Block|. > > Therefore :foo() means a Pair whose key is the string "foo" and whose > value is the empty list. Compare with :foo(1, 2, 3) which is the same > as foo => (1, 2, 3). > Thank you! So no Nil. <sniff, sniff> :'(