Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Type declaration question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Krishnaswami, Neel <neelk@c...>
Subject: [Caml-list] Type declaration question
Hello,

I'm wondering why record declarations can't be part of a regular
variant type declaration. Eg, is there a special reason that this
is illegal:

type expr = 
  | Fun of {formal: string; body: expr}
  | App of {func: expr; arg: expr}

and I must write: 

type expr = 
  | Fun of fun_expr
  | App of app_expr
and fun_expr = {formal: string; body: expr}
and app_expr = {func: expr; arg: expr}

IIRC the first version is ok in SML. Why the difference in Caml?

--
Neel Krishnaswami
neelk@cswcasa.com
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr