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 XAA20087; Tue, 24 Jul 2001 23:02:14 +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 XAA19972 for ; Tue, 24 Jul 2001 23:02:13 +0200 (MET DST) Received: from www.invert.com (invert.com [209.164.21.15]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f6OL2Cn15953 for ; Tue, 24 Jul 2001 23:02:12 +0200 (MET DST) Received: (from miles@localhost) by www.invert.com (8.10.1/8.10.1AA) id f6OL2AH38677; Tue, 24 Jul 2001 14:02:10 -0700 (PDT) (envelope-from miles) Date: Tue, 24 Jul 2001 14:02:10 -0700 From: Miles Egan To: Brian Rogoff Cc: caml-list@inria.fr Subject: Re: [Caml-list] a reckless proposal Message-ID: <20010724140210.B38516@caddr.com> References: <20010724110817.A35216@caddr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from bpr@best.com on Tue, Jul 24, 2001 at 12:44:52PM -0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, Jul 24, 2001 at 12:44:52PM -0700, Brian Rogoff wrote: > > Objects seem to provide more struct-like > > semantics, i.e. field names need only be unique within their class definition. > > Using objects in place of records is a bit clumsy, however, because object > > fields require accessors. If the rules for object field access were changed, > > however, objects would be just as convenient as records and less > > No, they'd still be *much* less convenient than records, since you can't > pattern match on objects. That's a big disadvantage, I agree. > > This approach has, in my mind, two advantages: > > 1. The object system becomes more generally useful. > > 2. A confusing and non-orthogonal feature of ocaml is subsumed into > > another, more generally useful and flexible feature. > > I understand this desire to unify features and remove non-orthogonalities, > but I don't like this proposal. I think it would be more interesting to > have a language with more polymorphism in records, as well as some more > flexibility in modules. By enhancing those aspects of the language the > advantages of classes would be reduced. Overall I agree. I wonder if the inria folks are interested in making changes in this area or if they're focusing on other things at the moment? I'll take a look at the SML# stuff. > Of course, if you're really into confusing, errr, unifying concepts, I > suppose we could unify modules and records too? No joke, I think a few > language designs do this. As much as unifying concepts, I'm interested in identifying the "false friends" new programmers encounter in Ocaml. Records are such "false friends" I believe. They resemble, even in syntax, C structs and are used in some fairly similar ways, but functionally they are quite different. I think this fact would be more obvious and less confusing if they weren't so enticingly but superficially familiar. Object syntax and behavior, on the other hand, is very similar to that found in more mainstream languages and causes less confusion, I think. Modules are another of these "false friends", I think. In most commonly-used languages, a module is rougly equivalent to a compilation unit and corresponds to a source file. In these languages, a module is essentially a collection of related types and functions. Ocaml top-level modules are very analagous, but "modules" in ML are actually a very different beast with as much in common with C++ templates as java packages. This convolution of function wasn't clear to me until I'd been programming in Ocaml for a while and I still find it fairly dissonant psychologically. In this case, I might even advocate ADDING new terminology to Ocaml and explicitly distinguishing compilation units from parametric polymorphs. -- miles "We in the past evade X, where X is something which we believe to be a lion, through the act of running." - swiftrain@geocities.com ------------------- 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