caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Thorsten Ohl <ohl@crunch.ikp.physik.th-darmstadt.de>
To: caml-list@pauillac.inria.fr
Subject: Class variables in O'Caml???
Date: Fri, 10 May 1996 12:46:02 +0200	[thread overview]
Message-ID: <9605101046.AA12307@crunch> (raw)


I have played a little bit with O'Caml yesterday and found that the
new features very conveniently formalize what I had been doing with
mutable records already.  Good job!

I have one question however: it seems that all variables in a class
are instance variables.  Have I overlooked something in the
documentation or can somebody explain to me why class variables
(i.e. variables that are shared mong all instances of a class) are a
bad idea?

The typical application is a class of non-uniform random number
generators, where the distribution to be generated would be an
instance variable, while the state of the underlying uniform
generator should be a class variable.  This way, differrent instances
will generate different distributions, but draw from the _same_ source
of random numbers.

It is possible to emulate this with references, of course.  But it
would be somewhat unnatural ...

Cheers,
-Thorsten





             reply	other threads:[~1996-05-10 11:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-10 10:46 Thorsten Ohl [this message]
1996-05-10 12:57 ` Class variables in O'Caml??? + questions Christian Boos
1996-05-10 15:13   ` Thorsten Ohl
1996-05-13 16:36     ` Jerome Vouillon
1996-05-13  1:06   ` Upcoming O'Labl 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=9605101046.AA12307@crunch \
    --to=ohl@crunch.ikp.physik.th-darmstadt.de \
    --cc=caml-list@pauillac.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;
as well as URLs for NNTP newsgroup(s).