Re: can't adverb and infix

2017-09-20 Thread Elizabeth Mattijsen

> On 19 Sep 2017, at 13:04, Brandon Allbery  wrote:
> 
> On Tue, Sep 19, 2017 at 3:44 AM, Luca Ferrari  wrote:
> this will sound trivial, but the following piece of code that in my
> mind should work does not:
> 
> $mode = 'csv' if ( ! $mode.defined || %available_modes{ $mode }:!exists );
> 
> and the compiler says:
> 
> You can't adverb :<||>
> 
> You want the adverb to be on the postcircumfix; parenthesize the expression. 
> IIRC this was considered the least bad alternative out of an ambiguous parse 
> (i.e. which operation does the adverb apply to?).
> 
> $mode = 'csv' if ( ! $mode.defined || (%available_modes{ $mode }:!exists) 
> );

Or use the lower precedence β€œor” instead of β€œ||”:

  $mode = 'csv' if ( ! $mode.defined or %available_modes{ $mode }:!exists );


Liz

Re: can't adverb and infix

2017-09-19 Thread Brandon Allbery
On Tue, Sep 19, 2017 at 3:44 AM, Luca Ferrari  wrote:

> this will sound trivial, but the following piece of code that in my
> mind should work does not:
>
> $mode = 'csv' if ( ! $mode.defined || %available_modes{ $mode }:!exists );
>
> and the compiler says:
>
> You can't adverb :<||>
>

You want the adverb to be on the postcircumfix; parenthesize the
expression. IIRC this was considered the least bad alternative out of an
ambiguous parse (i.e. which operation does the adverb apply to?).

$mode = 'csv' if ( ! $mode.defined || (%available_modes{ $mode
}:!exists) );

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net