caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: taha@cs.rice.edu
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] dynamic runtime cast in Ocaml
Date: Thu, 07 Nov 2002 16:22:20 +0900	[thread overview]
Message-ID: <20021107162220A.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: <Pine.GSO.4.33.0211062127230.18638-100000@frosty.cs.rice.edu>

From: Walid Taha <taha@cs.rice.edu>

> Were nested quantifiers (either existentials or universals) considered in
> the context of OCaml?  If not, are there plans to add them?  Thanks.

I'm not sure of what you are asking about, and whether this is
relevant to the question of runtime casts.

If this is a question of type systems, then yes there are nested
universal quantifiers in ocaml, which you can use either through
object types (polymorphic methods), record types (polymorphic fields)
or the module system (not first-class quantification, but this was not
explicit in your question).
For existential quantification, you only get it more or less with
modules. Note that modules defined by "let module" are a bit weak in
this context, as the types they define cannot escape their scope.

Does this answer your question, or were you talking about something
else?

By the way, for the expressivity addict (Curry-style), there is now a
branch in CVS with support for a specific form of dependent types. You
can get it by
  cvs update -r multimatch `cat testlabl/dirs_multimatch`
(when it is not broken).
I plan to provide it as a patch after the next release.

This allows you to do things like:
# let convert x y =
    multimatch y with
      `Int -> x
    | `Float -> float x
    | `String -> string_of_int x;;
val convert :
  int ->
  [< `Float & 'a = float | `Int & 'a = int | `String & 'a = string] -> 'a =
  <fun>
# convert 3 `String;;
- : string = "3"
# convert 2 `Float;;
- : float = 2.
and this without any overloading...

---------------------------------------------------------------------------
Jacques Garrigue      Kyoto University     garrigue at kurims.kyoto-u.ac.jp
		<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>
-------------------
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


  reply	other threads:[~2002-11-07  7:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-06 11:53 Basile STARYNKEVITCH
2002-11-06 12:54 ` Xavier Leroy
2002-11-07  2:01   ` Michael Vanier
2002-11-07  8:11     ` Jacques Garrigue
2002-11-07  3:28   ` Walid Taha
2002-11-07  7:22     ` Jacques Garrigue [this message]
2002-11-07 14:49       ` Walid Taha
2002-11-08 15:26       ` Alain Frisch
2002-11-11  9:26         ` Jacques Garrigue

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=20021107162220A.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=taha@cs.rice.edu \
    /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).