From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id UAA19178 for caml-redistribution; Mon, 13 May 1996 20:46:50 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id SAA17686 for ; Mon, 13 May 1996 18:36:24 +0200 Received: from nef.ens.fr (nef.ens.fr [129.199.96.12]) by concorde.inria.fr (8.7.1/8.7.1) with SMTP id SAA23442 for ; Mon, 13 May 1996 18:36:23 +0200 (MET DST) Received: from vedette.ens.fr by nef.ens.fr (5.65c8/ULM-1.0) Id AA09746 ; Mon, 13 May 1996 18:36:22 +0200 Date: Mon, 13 May 1996 18:36:20 +0200 (MET DST) From: Jerome Vouillon Subject: Re: Class variables in O'Caml??? + questions To: Thorsten Ohl Cc: caml-list@pauillac.inria.fr In-Reply-To: <9605101513.AA16888@crunch> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: weis On Fri, 10 May 1996, Thorsten Ohl wrote: > > >>>>> "Christian" == Christian Boos writes: > > Christian> IMO, the use of references is not so unnatural. Together > Christian> with structs, it provides a clean way to encapsulate global > Christian> state and actions for classes. > > Sure, it us possible to do it. But, IMHO, class variables should be > declared in the class and be opaque. If you put several classes in a > module, the use of module wide references makes much less sense. > Another hack is to define a sub-module for each class, but that's not > nice either ... > > 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, so I did not even thought of adding them. But I do not plan to implement class variables. I don't want to add too many features, and I don't think they are an important one: in my opinion, they are not commonly used, and they can be easily simulated using references as you noticed. Jerome Vouillon