[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pattern binding guards



Original-Via: uk.ac.nsf; Tue, 5 Mar 91 23:50:19 GMT
Date: Mon, 4 Mar 91 11:52:38 EST
From: john peterson <peterson-john@edu.yale.cs>
To: haskell@edu.yale.cs
Subject: Pattern binding guards
Original-Sender: peterson-john@cs.yale.edu
Sender: haskell-request@cs.glasgow.ac.uk

Although Simon's proposal looked OK at first, I'll side with Joe on
this.  Two objections:

a) This makes for some very peculiar holes in the scoping.  One of the
   advantages of Haskell is the simplicity of scoping.  Now we
   propose, for example, that a variable bound by a top level pattern
   binding be in scope everywhere except guard clauses in its own
   definition.  This complicates both the compiler and the language,
b) Fiddling with the scoping does not remove the original problem.  If
   we make

        y | y > 2       =  3
          | otherwise   =  1

   invalid on a syntactic basis, the clever user can just write

        y | x > 2       =  3
          | otherwise   =  1

        x = y

   So, I don't think this buys us anything.

  John