From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id NAA16642 for caml-redistribution; Fri, 10 May 1996 13:00:12 +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 MAA16429 for ; Fri, 10 May 1996 12:47:47 +0200 Received: from rs1.hrz.th-darmstadt.de (rs1.hrz.th-darmstadt.de [130.83.22.60]) by concorde.inria.fr (8.7.1/8.7.1) with SMTP id MAA26130 for ; Fri, 10 May 1996 12:47:40 +0200 (MET DST) Received: from crunch (crunch.ikp.physik.th-darmstadt.de [130.83.24.4]) by rs1.hrz.th-darmstadt.de (8.6.12/8.6.12.0ms) with SMTP id MAA17543 for ; Fri, 10 May 1996 12:46:03 +0200 Received: by crunch (AIX 3.2/UCB 5.64/Client-1.5/HRZ-THD) id AA12307; Fri, 10 May 1996 12:46:02 +0200 Date: Fri, 10 May 1996 12:46:02 +0200 Message-Id: <9605101046.AA12307@crunch> From: Thorsten Ohl To: caml-list@pauillac.inria.fr Subject: Class variables in O'Caml??? Sender: weis 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