Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2001-11-01 (15:27)
From: Krishnaswami, Neel <neelk@c...>
Subject: [Caml-list] Type declaration question

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
Bug reports:  FAQ:
To unsubscribe, mail  Archives: