From: Alain Frisch <frisch@clipper.ens.fr>
To: Maxence Guesdon <maxence.guesdon@inria.fr>
Cc: Michael Vanier <mvanier@cs.caltech.edu>, <caml-list@inria.fr>
Subject: Re: [Caml-list] class variables?
Date: Fri, 11 Jan 2002 13:19:31 +0100 (MET) [thread overview]
Message-ID: <Pine.GSO.4.33.0201111316580.16048-100000@clipper.ens.fr> (raw)
In-Reply-To: <20020111130920.338c2a9b.maxence.guesdon@inria.fr>
On Fri, 11 Jan 2002, Maxence Guesdon wrote:
> *But* if class foo has parameters, then the expressions before the 'objet' keyword are evaluated at
> each creation of a new instanciation, so in the following code
>
> class foo () =
> let my_list = [ "foo" ; "bar"] in
> object
> ...
> end
>
> let t = new foo
> let u = new foo
>
> t and u are two objects which don't share the list my_list.
You can write:
class foo =
let my_list = [ "foo" ; "bar"] in
fun () -> object
...
end
in order to share my_list ... or simply use a value defined
outside the scope of the class definition.
Alain
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next prev parent reply other threads:[~2002-01-11 12:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-10 23:43 Michael Vanier
2002-01-11 11:40 ` Warp
2002-01-11 18:09 ` Maxence Guesdon
2002-01-11 12:19 ` Alain Frisch [this message]
2002-01-11 12:25 ` Andreas Rossberg
2002-01-11 20:39 ` Michael Vanier
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=Pine.GSO.4.33.0201111316580.16048-100000@clipper.ens.fr \
--to=frisch@clipper.ens.fr \
--cc=caml-list@inria.fr \
--cc=maxence.guesdon@inria.fr \
--cc=mvanier@cs.caltech.edu \
/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