caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: Christophe Papazian <christophe.papazian@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Syntax of types
Date: Thu, 7 Feb 2013 15:48:55 +0900	[thread overview]
Message-ID: <CA+p7B-wMNz72sDHDwssBudTWjUpUqSafFk6D-Y1J4akaFO6hPA@mail.gmail.com> (raw)
In-Reply-To: <C1EDFF70-8E78-439C-BF0D-2278A2F03270@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 803 bytes --]

On Thu, Feb 7, 2013 at 3:21 PM, Christophe Papazian <
christophe.papazian@gmail.com> wrote:

> Hi
>
> I'm not sure to understand the difference between :
>
> let f (type s) : s t -> s = ...
> let f : type s . s t -> s = ...
>
> except it seems I can use the second one in place of the first one, but
> sometimes I can't use the first one and need the second one.
> So I feel I only need the second one.
>

As explained in the manual, they are not strictly equivalent.

http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual021.html#toc80

In particular the second syntax guarantees that the type is polymorphic,
and syntactically it can only used just after the defined identifier.

This said, in practice the second one mostly subsumes the first one (but it
is just syntactic sugar).

Jacques Garrigue

[-- Attachment #2: Type: text/html, Size: 1295 bytes --]

      reply	other threads:[~2013-02-07  6:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-07  6:21 Christophe Papazian
2013-02-07  6:48 ` Jacques Garrigue [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=CA+p7B-wMNz72sDHDwssBudTWjUpUqSafFk6D-Y1J4akaFO6hPA@mail.gmail.com \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=christophe.papazian@gmail.com \
    /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).