caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Implicit constraints in type declaration
@ 2001-01-21 16:59 Alain Frisch
  2001-01-21 21:31 ` Pierre Weis
  0 siblings, 1 reply; 2+ messages in thread
From: Alain Frisch @ 2001-01-21 16:59 UTC (permalink / raw)
  To: Caml list

Hello,

I don't understand why the following type declaration implies a
constraint:

# type 'a t = int and b = int t;;
type 'a t = int constraint 'a = int
type b = int t

Also, I don't understand this error message (I can imagine why
the declaration is illegal):

# type 'a t = u and u = int;;
                    ^^^^^^^
A type variable is unbound in this type declaration


-- 
  Alain Frisch



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Implicit constraints in type declaration
  2001-01-21 16:59 Implicit constraints in type declaration Alain Frisch
@ 2001-01-21 21:31 ` Pierre Weis
  0 siblings, 0 replies; 2+ messages in thread
From: Pierre Weis @ 2001-01-21 21:31 UTC (permalink / raw)
  To: Alain Frisch; +Cc: caml-list

> Hello,
> 
> I don't understand why the following type declaration implies a
> constraint:
> 
> # type 'a t = int and b = int t;;
> type 'a t = int constraint 'a = int
> type b = int t
> 
> Also, I don't understand this error message (I can imagine why
> the declaration is illegal):
> 
> # type 'a t = u and u = int;;
>                     ^^^^^^^
> A type variable is unbound in this type declaration
> 
> 
> -- 
>   Alain Frisch

All those glitches were due to a strange way of type cheking type
definitions using unification. Jacques (Garrigue) reimplemented the
old semantics for ordinary type definitions. Thus, your examples now
work fine in the working version of the compiler:

        Objective Caml version 3.00+20 (2000-12-03)

# type 'a t = int and b = int t;;
type 'a t = int
type b = int t
# type 'a t = u and u = int;;
type 'a t = u
type u = int

Best regards,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-01-21 21:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-21 16:59 Implicit constraints in type declaration Alain Frisch
2001-01-21 21:31 ` Pierre Weis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).