caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Chris King" <colanderman@gmail.com>
To: "Joel Reymont" <joelr1@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Instruction selection in the OCaml compiler: Modules or classes?
Date: Thu, 22 Feb 2007 14:55:42 -0500	[thread overview]
Message-ID: <875c7e070702221155q670f665dw829d72cebbe9acd8@mail.gmail.com> (raw)
In-Reply-To: <6CB0D237-F894-4AC3-BDBE-2BB484928D3C@gmail.com>

On 2/22/07, Joel Reymont <joelr1@gmail.com> wrote:
> I'm reading through the icfp99 slides on classes vs modules in OCaml.
> The part that I'm interested in starts on p27 where instruction
> selection in the OCaml compiler is discussed.

I've never seen these slides before; very interesting!  Personally I prefer modules, but find classes useful for the typing tricks you can do with them: the ability to hide type variables via subtyping is one of the prime benefits.  (The comparison in the slides between objects and closures I thought was particularly elucidating, since function closures are the other (clunkier) way of accomplishing the same thing.)

Also of note, the slides talk about late binding being possible with classes but not with modules, but thanks to recursive modules late binding is in fact possible with (some) modules by simply having a "class" module accept a "Self" module as a parameter, whose members are used when late binding is desired.  The final "object" module can then be created by recursively applying the (post-inheritance) "class" module to the "object" module.  The power of Caml's module system continues to amaze me... :)

- Chris


  parent reply	other threads:[~2007-02-22 19:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-22 14:38 Joel Reymont
2007-02-22 17:21 ` [Caml-list] " Tom
2007-02-22 17:38 ` Xavier Leroy
2007-02-22 19:55 ` Chris King [this message]
2007-02-22 19:59 ` Markus Mottl
2007-02-23 16:13 ` brogoff
2007-02-23 18:14   ` Tom
2007-02-23 19:28     ` [Caml-list] Instruction selection in the OCaml compiler: Modulesor classes? Andreas Rossberg
2007-02-24  2:51       ` skaller
2007-02-24 11:48         ` David Baelde
     [not found]           ` <4a708d20702240518l2c430b06r18fe64cabe5cbe9@mail.gmail.com>
2007-02-24 13:33             ` Lukasz Stafiniak
2007-02-24 14:58         ` [Caml-list] Instruction selection in the OCaml compiler:Modulesor classes? Andreas Rossberg
2007-02-24 17:39           ` 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=875c7e070702221155q670f665dw829d72cebbe9acd8@mail.gmail.com \
    --to=colanderman@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=joelr1@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).