Re: Class variables in O'Caml??? + questions

David Gurr (gurr@snap.med.ge.com)
Mon, 13 May 1996 12:04:20 -0700

Date: Mon, 13 May 1996 12:04:20 -0700
From: gurr@snap.med.ge.com (David Gurr)
Message-Id: <9605131904.AA12355@swag.med.ge.com>
To: caml-list@pauillac.inria.fr
Subject: Re: Class variables in O'Caml??? + questions

Jerome Vouillon <vouillon@clipper.ens.fr>:

> On Fri, 10 May 1996, Thorsten Ohl wrote:
> > Sure, it us possible to do it. But, IMHO, class variables should be
> > declared in the class and be opaque.
> > ...
> > I'm just curious if (and why) this syntactic sugar has been left out
> > intentionally.
>
> It has not been left out intentionally. Many object-oriented languages
> (C++, Objective C and Modula 3, for instance) do not have class variables,

C++ does have class variables but since everything is renamed in C++
they are called static member variables or static data members or ... .

> ... they can be easily simulated using references as you noticed.

Why not make class variables exactly that, slots of the class object?

-D