From: Vyskocil Vladimir <Vladimir.Vyskocil@sophia.inria.fr>
To: caml-list@inria.fr
Subject: Re: Constructeurs en O'Caml
Date: Wed, 09 Oct 1996 12:44:44 +0200 [thread overview]
Message-ID: <199610091044.MAA16986@psyche.inria.fr> (raw)
In-Reply-To: Your message of "Wed, 09 Oct 1996 12:26:31 +0200." <199610091026.MAA11690@arthur.u-strasbg.fr>
> Vyskocil Vladimir writes:
> > Existe-t'il comme en C++ une fonction qui est appelee a la construction d'un
> > objet (pas seulement pour initialiser des variables d'instances) ?
>
> No, there's nothing such a "constructor" method, but a way to circumvent this
> is to do the job as a side effect, when initializing the members. See the fol-
> lowing sample code :
>
> class my_class name =
> (* MEMBERS *)
>
> val n =
> (* begin constructor *)
> ...;
> (* end constructor *)
> name
>
> (* METHODS *)
> ...
> end
>
Yes, but such contructor can't call a object method because self is
bind only at execution ie I can't do the following :
class my_class name as self =
(* MEMBERS *)
val n =
(* begin constructor *)
self#init;
...;
(* end constructor *)
name
(* METHODS *)
method init =
...
end
--
Vyskocil Vladimir
vvyskoci@sophia.inria.fr
http://www.inria.fr/safir/SAFIR/Vladimir.html
next prev parent reply other threads:[~1996-10-09 11:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-10-09 9:25 Vyskocil Vladimir
1996-10-09 10:26 ` Christian Boos
1996-10-09 10:44 ` Vyskocil Vladimir [this message]
1996-10-09 12:12 ` Christian Boos
1996-10-10 15:30 ` Jerome Vouillon
1996-10-23 13:01 ` 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=199610091044.MAA16986@psyche.inria.fr \
--to=vladimir.vyskocil@sophia.inria.fr \
--cc=caml-list@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