Question about scope of 'let' and 'where'

Matt Hellige matt@immute.net
Mon, 17 Mar 2003 10:25:30 -0600


[Hal Daume III <hdaume@ISI.EDU>]
> It is not.  Lets are expressions.  Wheres are part of declarations.  In a
> grammar sense, you have something like:
> 
> funcdef ::= name = expr (where decls)?
> expr    ::= let decls in expr
> 
> so the declarations inside a let are internal to the expression and can't
> go outside into the where clause.

Shouldn't the layout rule make this apparent? Is the following really
OK?

> In the function body (rhs):
> 
>      let
>          { a = (e1) }
>      in
>         (e2)
>         where
>              { b = f a }

I'd say that's pretty misleading, and maybe should be illegal
layout...?

Matt

-- 
Matt Hellige                  matt@immute.net
http://matt.immute.net