develooper Front page | perl.perl6.language | Postings from September 2005

Re: Proposal: split ternary ?? :: into binary ?? and //

Thread Previous | Thread Next
From:
Luke Palmer
Date:
September 5, 2005 22:39
Subject:
Re: Proposal: split ternary ?? :: into binary ?? and //
Message ID:
7ca3f01605090522385f009cfb@mail.gmail.com
On 9/6/05, Damian Conway <damian@conway.org> wrote:
> Luke wrote:
> 
>  > Yeah.  Hmm, but I kinda like the look of ?? //, and I don't like the
>  > overloading of :: in that way anymore.   So it's possible just to add
>  > a ternary ?? // in addition to, and unrelated to (from the parser's
>  > perspective), the regular //.
> 
> Bad idea. This useful construct would then be ambiguous:
> 
>      $val = some_cond()
>                ?? $arg1 // $arg1_default
>                // $arg2 // $arg2_default;

Huh, yeah.  We'd have to go one way or the other on that, and neither
of those are what you intend.

Not that being explicit is always a bad thing:

    $val = some_cond()
              ?? ($arg1 // $arg1_default)
              // ($arg2 // $arg2_default)

And I question your notion of "highly useful" in this case.  Still, it
is probably linguistically not a good idea to overload // like that.

> 
>  > ?? !! ain't bad either.
> 
> It's definitely much better that sabotaging the (highly useful) // operator
> within (highly useful) ternaries.

I guess the thing that I really think is nice is getting :: out of
that role and into the type-only domain.

Luke

Thread Previous | 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