Browse thread
mixed functional / object style
- Guillaume Hennequin
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2009-04-18 (14:48) |
From: | Guillaume Hennequin <gje.hennequin@g...> |
Subject: | mixed functional / object style |
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.