caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Cc: lukstafi@gmail.com, caml-list@inria.fr
Subject: Re: [Caml-list] Fwd: "ocaml_beginners"::[] Trouble combining polymorphic classes and polymorphic methods
Date: Wed, 28 Feb 2007 12:57:56 +1100	[thread overview]
Message-ID: <1172627876.19033.85.camel@rosella.wigram> (raw)
In-Reply-To: <20070228.103403.105433774.garrigue@math.nagoya-u.ac.jp>

On Wed, 2007-02-28 at 10:34 +0900, Jacques Garrigue wrote:

> and polymorphism. What some people do not like about structural types
> is that they do not "brand" types: you can define the same type
> elsewhere, possibly with a different intended meaning, and the
> compiler will not distinguish between the two. 

Of course you CAN brand types if you want to!

type 'a metres = Metres of 'a 
type 'a feet = Feet of 'a 

type int_metres = int metres
type int_feet = int feet

or perhaps 

type metres = { metre: int }
type feets  = { feet: int }

or some other trick with phantom types I'm sure someone will
point out.

After all a nominal type is just a structural type with
a unique tag representing its unique name.

Look at in the converse: a structural type is just the
canonical representative of nominal types with the
same structure.

Or perhaps i'm confused .. :)

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


  reply	other threads:[~2007-02-28  1:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <301730110702251747y72ae9fbdqd33bd8d08293cbe3@mail.gmail.com>
2007-02-27 21:22 ` Geoffrey Romer
2007-02-28  0:23   ` [Caml-list] " Jacques Garrigue
2007-02-28  1:18     ` Lukasz Stafiniak
2007-02-28  1:34       ` Jacques Garrigue
2007-02-28  1:57         ` skaller [this message]
2007-02-28  3:23           ` Daniel Bünzli
2007-02-28  4:01             ` Jacques Garrigue
2007-02-28  5:09               ` skaller
2007-02-28 13:47               ` Daniel Bünzli

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=1172627876.19033.85.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@inria.fr \
    --cc=garrigue@math.nagoya-u.ac.jp \
    --cc=lukstafi@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).