Browse thread
Why isn't -rectypes command line option the default
-
Erik de Castro Lopo
-
Zheng Li
-
Erik de Castro Lopo
- james woodyatt
- Ville-Pertti Keinonen
- Gerd Stolpmann
-
Erik de Castro Lopo
-
Zheng Li
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-03-21 (09:01) |
From: | Ville-Pertti Keinonen <will@e...> |
Subject: | Re: [Caml-list] Re: Why isn't -rectypes command line option the default |
On Mar 21, 2007, at 4:13 AM, Erik de Castro Lopo wrote: > Wouldn't it be nicer to be able to specify the rectypes behaviour > per type? Maybe something like this would work: > > rec type 'a t = 'a * 'a t Lazy.t It would probably be possible to allow that by default with no extra keyword, since errors are unlikely when writing a type explicitly. But the ability to write recursive type aliases would not make actually creating recursively typed values all that convenient, you'd have to give the type explicitly (I'd rather just use a variant and a constructor). Note that in the example using -rectypes posted by Zheng Li, the type 'a t is never actually used for anything - presumably it's intended as an illustration to the reader, and could just as well be a comment - the type inferred for fib is compatible, but not named int t.