caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sven LUTHER <luther@dpt-info.u-strasbg.fr>
To: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
Cc: barnier@recherche.enac.fr, qrczak@knm.org.pl, caml-list@inria.fr
Subject: [Caml-list] Re: OCaml's long range graphical direction?
Date: Thu, 15 Feb 2001 13:21:17 +0100	[thread overview]
Message-ID: <20010215132117.C28656@lambda.u-strasbg.fr> (raw)
In-Reply-To: <20010213084705X.garrigue@kurims.kyoto-u.ac.jp>; from garrigue@kurims.kyoto-u.ac.jp on Tue, Feb 13, 2001 at 08:47:05AM +0900

On Tue, Feb 13, 2001 at 08:47:05AM +0900, Jacques Garrigue wrote:
> From: Nicolas barnier <barnier@recherche.enac.fr>
> > Marcin 'Qrczak' Kowalczyk wrote:
> > > 
> > > What are variance annotations in OCaml?
> > 
> > Perniciously stolen on the OCaml CVS server (file "Changes"), but I lack
> > the new doc ;-):
> > 
> > Objective Caml 3.01:
> > --------------------
> > 
> > New language features:
> > - Variables are allowed in "or" patterns, e.g.
> >      match l with [t] | [_;t] -> ... t ...
> > - "include <structure expression>" to re-export all components of a
> >   structure inside another structure.
> > - Variance annotation on parameters of type declarations, e.g.
> >     type (+'a,-'b,'c) t (covariant in 'a, contravariant in 'b, invariant in 'c)
> 
> Yes, this is the syntax.
> Practically, this means that you can now mix object and variant
> subtyping with both datatypes and abstract types.
> 
> For instance, suppose that you have two types c and d, d subtype of c.
> In ocaml 3.00, to coerce a list of d's to a list of c's, you would
> have to write
>      List.map (fun x -> (x : d :> c)) l
> In ocaml 3.01, you can do it directly
>      (l : d list :> c list)
> because list is a covariant type, which you can see from its definition.
> 
> Not only that, but thanks to explicit variance annotations, even
> abstract datatypes, like maps from the Map module, can be traversed by
> subtyping.
> My remark on a lesser need for "hacked" coercions is a side-effect of
> that.

Are there any papers on the subject available ?

Friendly,

Sven Luther
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


  reply	other threads:[~2001-02-15 12:27 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-05 17:48 Daniel Ortmann
2001-02-06  9:28 ` Xavier Leroy
2001-02-06 18:19   ` Sven LUTHER
2001-02-07 21:30     ` Pierre Weis
2001-02-08  7:32       ` Sven
2001-02-08  1:59     ` Jacques Garrigue
2001-02-08  7:55       ` Sven
2001-02-09  8:47         ` Claudio Sacerdoti Coen
2001-02-09 10:00           ` Sven LUTHER
2001-02-08 20:35       ` Brian Rogoff
2001-02-09  1:28         ` Jacques Garrigue
2001-02-09 18:11           ` Brian Rogoff
2001-02-10 13:01             ` Jacques Garrigue
2001-02-09 20:01           ` Marcin 'Qrczak' Kowalczyk
2001-02-12 14:52             ` Nicolas barnier
2001-02-12 23:47               ` Jacques Garrigue
2001-02-15 12:21                 ` Sven LUTHER [this message]
2001-02-08 10:28     ` Alan Schmitt
2001-02-09  1:24       ` bcpierce
2001-02-06 20:30   ` Dale Arntson
2001-02-07  0:39   ` John Max Skaller
2001-02-08 20:01   ` Francois Rouaix
2001-02-09  9:41     ` Sven LUTHER
2001-02-09  9:49     ` Jacques Garrigue
2001-02-09 19:58       ` Jerome Vouillon
2001-02-10 12:36         ` Jacques Garrigue
2001-02-10 21:25         ` Pierre Weis
2001-02-09 17:50     ` John Max Skaller

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=20010215132117.C28656@lambda.u-strasbg.fr \
    --to=luther@dpt-info.u-strasbg.fr \
    --cc=barnier@recherche.enac.fr \
    --cc=caml-list@inria.fr \
    --cc=garrigue@kurims.kyoto-u.ac.jp \
    --cc=qrczak@knm.org.pl \
    /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).