caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pierre Weis <pierre.weis@inria.fr>
To: frisch@clipper.ens.fr (Alain Frisch)
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Comments on type variables
Date: Sun, 9 Jun 2002 19:29:58 +0200 (MET DST)	[thread overview]
Message-ID: <200206091729.TAA01309@pauillac.inria.fr> (raw)
In-Reply-To: <Pine.SOL.4.44.0206061858320.11096-100000@clipper.ens.fr> from Alain Frisch at "Jun 6, 102 07:04:48 pm"

Hello Alain,

There already had been a long thread on the subject in this list.

You are right and I guess all the implemnetors aggree with you :
therés a problem with type constraints.

[...]


> A paragraph in the FAQ is somewhat misleading:
> 
> << Polymorphism appears when we introduce type schemes, that is types
>    with universally quantified type variables.
> ...
>    The polymorphism is only introduced by the definition of names during
>    a let construct (either local, or global).
> >>
> 
> The last sentence seems to contradict the first; the programmer doesn't
> introduce type schemes.

The first occurrence of ``we'' means we, type theorists, not we,
actual programmers; in effect, as you said, there is no means for the
Caml programmer to introduce type scheme parameters (or polymorphic
variables as you said). (Except recently for method definitions, and
the notation used could probably be extended to the rest of type
constraints).

You may also have a look at the french version: I may have made a
mistake or oversimplification when translating into english.

[...]
> Also, why are class parameters enclosed in brackets ?
> type 'a t = ...
> but:
> class ['a] t = ...
> and not:
> class 'a t = ...

Ask Yacc! As far as I remember, we needed those explicit brackets to
delimit type parameters of a class from type parameters of types, when
mixing types and classes...

> '_a variables
> -------------
> 
> It is not possible to specify "impure" type variables:

You are right, and it is probably desirable to clarify a lot of examples.

> Variable name in error message
> ------------------------------
> 
> Error messages would be more readable if they retained (when possible)
> variable names:
> 
> # let f (a : 'a) (b : 'b list) = b + 1;;
> This expression has type 'a list but is here used with type int

This is a long standing misfeature of Caml, that is unfortunately not
at all easy to fix.

Best regards,

Pierre Weis

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


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


      parent reply	other threads:[~2002-06-09 17:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-06 17:04 Alain Frisch
2002-06-07  7:07 ` Francois Pottier
2002-06-07 10:23 ` Jacques Garrigue
2002-06-11 13:09   ` Laurent Vibert
2002-06-09 17:29 ` Pierre Weis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200206091729.TAA01309@pauillac.inria.fr \
    --to=pierre.weis@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=frisch@clipper.ens.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).