From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA27314; Wed, 25 Jul 2001 11:33:40 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA27233 for ; Wed, 25 Jul 2001 11:33:39 +0200 (MET DST) Received: from mrwall.kal.com (mrwall.kal.com [194.193.14.236]) by nez-perce.inria.fr (8.11.1/8.10.0) with SMTP id f6P9XcD29842 for ; Wed, 25 Jul 2001 11:33:38 +0200 (MET DST) Received: from mrwall.kal.com [194.193.14.236] (HELO localhost) by mrwall.kal.com (AltaVista Mail V2.0J/2.0J BL25J listener) id 0000_0050_3b5e_9322_521b; Wed, 25 Jul 2001 10:36:34 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [Caml-list] a reckless proposal content-class: urn:content-classes:message X-MimeOLE: Produced By Microsoft Exchange V6.0.4417.0 Date: Wed, 25 Jul 2001 10:30:09 +0100 Message-ID: <8E31D6933A2FE64F8AE3CC1381EEDCE70B2AEA@NT.kal.com> Thread-Topic: [Caml-list] a reckless proposal Thread-Index: AcEUa3x2AFfO1FemTGmsKmFh1fFu9gAgOUZg From: "Dave Berry" To: "Miles Egan" , Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > From: Miles Egan [mailto:miles@caddr.com] > Sent: 24 July 2001 19:08 >=20 > Records are confusing because they resemble C > structs and are used in similar ways, but are really quite=20 > different. Objects are confusing because their use is mildly > discouraged and because their functionality significantly > overlaps that of the module system. >=20 > The most frustrating feature of records, of course, is that=20 > each record field name must be globally unique. Objects seem > to provide more struct-like semantics, i.e. field names need > only be unique within their class definition. So perhaps Ocaml should adopt the approach used in Dylan and Moby, where field names in class definitions have module scope. Then records and objects would have similar scoping rules, instead of the current clash, and the distinction between modules and objects would be clearer. > For example, if object > fields were directly accessible by default, one could use: >=20 > class point =3D > object > val x =3D 0 > val y =3D 0 > end >=20 > and access p.x and p.y directly,=20 But if you then replace the field with an accessor method, you have to edit all uses of that field. It's a common recommendation that OO languages should only access field by accessor methods (or at least use the same syntax as accessor methods). As you point out, Ruby does it this way. Dylan and Eiffel are other examples. ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr