From: John Prevost <j.prevost@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Possibility of Nested Classes and Nested Inheritance?
Date: Thu, 16 Dec 2004 16:50:53 -0500 [thread overview]
Message-ID: <d849ad2a0412161350575ff45a@mail.gmail.com> (raw)
In-Reply-To: <20041216145907.GB5599@hex.no>
On Thu, 16 Dec 2004 15:59:07 +0100, Jørgen Hermanrud Fjeld <jhf@hex.no> wrote:
> It seems to me that inner classes can always be written as
> parametric classes, which means that OCaml could easily support
> inner classes. Is this correct? Are there other intrinsic
> reasons why OCaml does not have inner classes, except of course
> that it would take an effort to implement, which I understand.
One typical feature of inner classes that you will never see in O'Caml
is access to the private state of the surrounding class. On the other
hand:
class a (xa : int) =
object
val mutable xb = xa
method get_x = xb
method set_x x = xb <- x
method new_b () = object
method get_x = xb
method set_x x = xb <- x
end
end;;
Here you see that you can create an object in which the fields of the
containing object are in scope. But this inner object is not a class,
so it cannot be inherited from.
Anyway, I will look at the rest of your email and look up the papers
your mention some time later.
John.
next prev parent reply other threads:[~2004-12-16 21:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-16 14:59 Jørgen Hermanrud Fjeld
2004-12-16 21:50 ` John Prevost [this message]
2004-12-17 1:31 ` [Caml-list] " Jacques Garrigue
[not found] <20041217184433.GA1036@balm.cs.cornell.edu>
2004-12-24 19:48 ` Nate Nystrom
2004-12-25 0:26 ` skaller
2004-12-25 10:59 ` Jacques Garrigue
2004-12-27 2:24 ` 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=d849ad2a0412161350575ff45a@mail.gmail.com \
--to=j.prevost@gmail.com \
--cc=caml-list@yquem.inria.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