English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
RE: OCaml bug or feature?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-12-03 (22:10)
From: Manuel Fahndrich <maf@m...>
Subject: RE: OCaml bug or feature?

I think the problem you refer to is checking equivalence of parameterized
type definitions "Type Definitions With Parameters" Marvin Solomon 5th POPL.
The problem is equivalent to checking the equivalence of deterministic
pushdown automaton, which has since been shown decidable, although I know of
no practical algorithm.

Keep in mind though that the problem only arises in the presence of
non-regular types. Thus another approach is to simply disallow non-regular
types, which OCaml does for non-datatype definitions.

E.g. It is possible to define general regular parameterized recursive types
using polymorphic variants alone, ie., without explicit datatype

type 'a list = [`Nil | `Cons of `a * 'a list ];


-----Original Message-----
From: Daniel C. Wang [mailto:danwang+news@cs.princeton.edu]
Sent: Thursday, November 30, 2000 11:37 AM
To: comp-lang-ml@uunet.uu.net
Subject: Re: OCaml bug or feature?

Henning Makholm <henning@makholm.net> writes:

> Scripsit "Daniel C. Wang" <danwang+news@cs.princeton.edu>
> > The datatype constructors in both OCaml and SML are *type annotations*
> > just are unobtrusive and *mandatory* type annotations. Without the
> > constructor tags the type inference system would have no way to deal
> > properly with reucursive types. 
> Do you have references to good explanations of what the exact
> problems you refer to are?

Nope... sorry.. this just my fuzzy understanding of how recursive types are
treated by type inference.. without the annotations, you have to guess how
many times you need to unfold/fold the recursive type for things to type

> My experience (though not with full-sized
> ML-type languages) is that declaration-free recursive type inference
> is piece of cake once you have a circular unification algorithm.
> Sure, with polymorphism you get the same trouble with principal
> types as SML has with record types, but nothing more.

I was under the impression that the problem without the constructors made
the problem undecidable, but maybe I'm wrong...

> (Strangely enough it is not easy to find literature references
> to this. There was a paper on "Declaration-free type checking"
> by P.Mishra and U.Reddy in POPL'85, but that is much more
> complicated than necessary for mere declaration-free ML-style
> type inference because it includes union types and subtyping).

Have you tried citeseer?


and doing a reverse citation lookup...