Too many Reimanns & Not enough role?

-jas

On 18 January 2016 at 11:37, Elizabeth Mattijsen <l...@dijkmat.nl> wrote:
>
>> On 18 Jan 2016, at 19:55, Tom Browder <tom.brow...@gmail.com> wrote:
>>
>> In creating some new Perl 6 programs I've run across several instances
>> I'm confused about, to wit:
>>
>> Example 1
>> ---------------
>>
>>> my %h; say 'false' if !%h<a>:exists;
>> Unexpected named parameter 'exists’ passed
>
> Yeah, this is an unexpected one.  However, there is a simple solution:
>
>   my %h; say 'false' if %h<a>:!exists;
>
> In general, :foo is equivalent to foo => True, and :!foo is equivalent to foo 
> => False.
>
>
>> Example 2
>> ---------------
>>
>>> my %h; say 'false' if not %h<a>:exists;
>> false
>>
>> It looks like '!' doesn't work as I thought it was supposed to.  But,
>> I just discovered that when I use parens, it works.
>
> Yes, the ! binds closer, and eats the :exists, and then complains about it.
>
>
>
> Liz

Reply via email to