On 11/06/07, Audrey Tang <[EMAIL PROTECTED]> wrote:

在 Jun 11, 2007 5:10 AM 時,Jonathan Lang 寫到:
> A variation of chaining associativity gets
> used, with the "chaining rule" being '$v1 op1 $v2 // $v1 op2 $v3'
> instead of '$v1 op1 $v2 && $v2 op2 $v3', as is the case for comparison
> chaining.

But wouldn't that make:

   True ?? undef !! Moose;

evaluate to Moose, instead of undef as we wanted?

Perhaps I haven't understood hypothetical variables, but would it make
sense to make ?? hypothetically bind its LHS?

That way, !! would be analogous to the other short-ciruiting "or" operators:

  ||   # truth
  //   # definedness
  !!   # boundness

This haskell seems to be equivalent (using ? ! as the token "!!" is
already in use).

 True  ? a = Just a
 False ? _ = Nothing

 Just a  ! _ = a
 Nothing ! b = b

*Main> True ? "Bill" ! "Ben"
"Bill"
*Main> False ? "Bill" ! "Ben"
"Ben"

Ciao,
osfameron

Reply via email to