[nem-en] nested declarations?

Michal Moskal michal.moskal at gmail.com
Thu Jan 12 14:02:42 CET 2006


On 1/12/06, Maurizio Colucci <maurizio.colucci at gmail.com> wrote:
> I know nested funcions are supported in Nemerle, but are nested
> variable declarations allowed? i.e. what is the Nemerle translation
> for the following ocaml code?
>
> let foo x =
>   let val1 =
>     let r =
>        r + 5
>     in
>     x + r
>   in
>   val1 + x

def foo (x) {
  def val1 = {
    def r = r + 5;
    x + r
  }
  val1 + x
}

It looks better with indenation syntax enabled (just remove {, } and
compile with -i).

Hope this helps!

--
   Michal Moskal,
   http://nemerle.org/~malekith/



More information about the devel-en mailing list