RE: Q: Can colons control backtracking in logical expressions?

2004-04-02 Thread Austin Hastings
> -Original Message- > From: Larry Wall [mailto:[EMAIL PROTECTED] > > On Fri, Apr 02, 2004 at 03:05:30PM +0100, Simon Cozens wrote: > : [EMAIL PROTECTED] (Austin Hastings) writes: > : > > if (specific() ?? detail1() && detail2() :: general()) {...} > : > > : > For some value of "correc

Re: Q: Can colons control backtracking in logical expressions?

2004-04-02 Thread Aaron Sherman
On Fri, 2004-04-02 at 10:01, Larry Wall wrote: > Even an almost purely RPN language > like Japanese likes to use honorifics and/or a bunch of particles to > mark the ends of its sentences, yo? Hai, and it's not just there to help in error reporting. Imagine the case: if if if if if ... {.

Re: Q: Can colons control backtracking in logical expressions?

2004-04-02 Thread Larry Wall
On Fri, Apr 02, 2004 at 03:05:30PM +0100, Simon Cozens wrote: : [EMAIL PROTECTED] (Austin Hastings) writes: : > > if (specific() ?? detail1() && detail2() :: general()) {...} : > : > For some value of "correct" I suppose. Using ??:: within an if/else context : > makes my skin crawl, stylistic

Re: Q: Can colons control backtracking in logical expressions?

2004-04-02 Thread Simon Cozens
[EMAIL PROTECTED] (Austin Hastings) writes: > > if (specific() ?? detail1() && detail2() :: general()) {...} > > For some value of "correct" I suppose. Using ??:: within an if/else context > makes my skin crawl, stylistically. :-( Ah, then use if! if (if(specific()) { detail() } else { ge

RE: Q: Can colons control backtracking in logical expressions?

2004-04-02 Thread Austin Hastings
> -Original Message- > From: Damian Conway [mailto:[EMAIL PROTECTED] > > > Since paren's aren't required with keywords, can they still serve as rex > > delimiters? > > No. For other syntactic reasons parens aren't allowed as rule > delimiters at all. And only /.../ delimit "raw" matches. Ev

Re: Q: Can colons control backtracking in logical expressions?

2004-04-02 Thread Damian Conway
> All you really need is: > > if ( specific_condition() ? detail() : general_condition() ) Oops! That's the Perl 5 version. In Perl 6, of course, it's: if ( specific_condition() ?? detail() :: general_condition() ) Which means you *do* get to use the :: after all! (Just not where you mi

Re: Q: Can colons control backtracking in logical expressions?

2004-04-02 Thread Damian Conway
Austin Hastings wrote: Both look horrible, of course. I'd like to rewrite them as if (specific_condition() :: && detail()) || general_condition() { act(); } so that if specific_condition() succeeded, it would cause the entire expression to fail if detail() failed. The use of :: comes, o

Q: Can colons control backtracking in logical expressions?

2004-04-02 Thread Austin Hastings
Consider this code: if (specific_condition()) { if (detail()) { act(); } } elsif (general_condition()) { act(); } Logically, this turns into: if ((my $sc = specific_condition()) && detail()) || (!$sc && general_condition()) { act(); } Both look