caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus@oefai.at>
To: Alain Frisch <frisch@clipper.ens.fr>
Cc: Caml list <caml-list@inria.fr>
Subject: Re: [Caml-list] Type variables (was: Odd Type Checking Problem)
Date: Thu, 7 Feb 2002 13:25:25 +0100	[thread overview]
Message-ID: <20020207122525.GB22578@fichte.ai.univie.ac.at> (raw)
In-Reply-To: <Pine.GSO.4.33.0202071205590.24659-100000@clipper.ens.fr>

On Thu, 07 Feb 2002, Alain Frisch wrote:
> Actually, I feel myself somewhat confused with implicit introduction and
> scoping of type variables.
> 
> These one are refused:
> 
> let f (x : 'a) = let module M = struct exception X of 'a end in ();;
> let f (x : 'a) = let module M = struct type t = 'a end in ();;
[snip]
> Is there a way to use a type variable such as the 'a above to define
> types in a local structure ?

This issue has already popped up in the past. See, for example:

  http://caml.inria.fr/archives/200107/msg00223.html

There is unfortunately no way (yet) to use type variables in the way
shown above. When there is a type variable in a type definition, the type
checker will look for a binding at the level of the type definition,
not any further (I hope this explanation comes close to what is really
happening).

Are there any plans to lift this restriction? This would e.g. allow using
polymorphic types in functor arguments that expect monomorphic instances,
because the free variable could be bound in an outer scope. For instance,
one could create "polymorphic" sets of elements with the already existing
Set-implementation.

Regards,
Markus Mottl

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2002-02-07 12:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-06 19:37 [Caml-list] Odd Type Checking Problem Jonathan D Eddy
2002-02-06 22:59 ` Alain Frisch
2002-02-07  9:45   ` Tom Hirschowitz
2002-02-07 10:04     ` Tom Hirschowitz
2002-02-07 11:21   ` [Caml-list] Type variables (was: Odd Type Checking Problem) Alain Frisch
2002-02-07 12:25     ` Markus Mottl [this message]
2002-02-08  1:33       ` Jacques Garrigue
2002-02-08  9:24         ` Markus Mottl
2002-02-07  3:15 ` [Caml-list] Odd Type Checking Problem stalkern2
2002-02-06 21:19   ` Remi VANICAT

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=20020207122525.GB22578@fichte.ai.univie.ac.at \
    --to=markus@oefai.at \
    --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).