From: Andreas Rossberg <rossberg@ps.uni-sb.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] class variables?
Date: Fri, 11 Jan 2002 13:25:06 +0100 [thread overview]
Message-ID: <3C3ED9A2.3A5EB392@ps.uni-sb.de> (raw)
In-Reply-To: <20020111130920.338c2a9b.maxence.guesdon@inria.fr>
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
You probably meant
let t = new foo ()
let u = new foo ()
> t and u are two objects which don't share the list my_list.
Right, but you can push the lambda below the let, much like for function
definitions:
class foo =
let my_list = [ "foo" ; "bar"] in
fun arg ->
object
...
end
This should do what Michael wants.
- Andreas
--
Andreas Rossberg, rossberg@ps.uni-sb.de
"Computer games don't affect kids; I mean if Pac Man affected us
as kids, we would all be running around in darkened rooms, munching
magic pills, and listening to repetitive electronic music."
- Kristian Wilson, Nintendo Inc.
-------------------
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:25 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
2002-01-11 12:25 ` Andreas Rossberg [this message]
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=3C3ED9A2.3A5EB392@ps.uni-sb.de \
--to=rossberg@ps.uni-sb.de \
--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