From: Guillaume Hennequin <gje.hennequin@gmail.com>
To: caml-list@yquem.inria.fr
Subject: mixed functional / object style
Date: Sat, 18 Apr 2009 16:48:23 +0200 [thread overview]
Message-ID: <d8e32b760904180748h25b5dc06t3e204fbdc8caafde@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 684 bytes --]
Dear list,
this is a somewhat naive question
let's define
class a = object
val mutable v = ...
method v = v
method m = something that uses v
end ;;
now assume that I want to create a lot of those a objects, so many that I
may encounter memory problems.
I thought the following would be better, memory wise, but when I test it
doesn't seem to be the case
class a = object
val mutable v = ...
method v = v
end ;;
and instead of each object having its own method m, I define it separately
let m x = something that calls x#v
This question is somewhat equivalent to: what is the memory consumption of a
simple method
method m = let _ = self#v in () ??
Thanks a lot
Guillaume.
[-- Attachment #2: Type: text/html, Size: 786 bytes --]
next reply other threads:[~2009-04-18 14:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-18 14:48 Guillaume Hennequin [this message]
2009-04-20 5:34 ` [Caml-list] " Jacques Garrigue
2009-04-20 6:14 ` Goswin von Brederlow
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=d8e32b760904180748h25b5dc06t3e204fbdc8caafde@mail.gmail.com \
--to=gje.hennequin@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