From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA30994 for caml-redistribution; Wed, 3 Feb 1999 12:02:20 +0100 (MET) 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 TAA14460 for ; Sun, 31 Jan 1999 19:43:15 +0100 (MET) Received: from hadar.cse.Buffalo.EDU (hadar.cse.Buffalo.EDU [128.205.32.1]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id TAA14759 for ; Sun, 31 Jan 1999 19:43:13 +0100 (MET) Received: (from whitley@localhost) by hadar.cse.Buffalo.EDU (8.8.8/8.8.5) id NAA13811; Sun, 31 Jan 1999 13:43:12 -0500 (EST) From: John Whitley MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sun, 31 Jan 1999 13:43:12 -0500 (EST) To: caml-list@inria.fr Subject: RE: Looking for a nail In-Reply-To: <39ADCF833E74D111A2D700805F1951EF0F00B93A@RED-MSG-06> References: <39ADCF833E74D111A2D700805F1951EF0F00B93A@RED-MSG-06> X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs Lucid Message-ID: <14004.38166.379525.372253@hadar.cse.Buffalo.EDU> Sender: weis Don Syme writes: > Yes, I'd be interested to see a really convincing use of the > utility of the OO features, e.g. a program or library which is > manifestly shorter, cleaner and/or simpler when expressed with OO > rather than the core features. Here's an example of something that I would like to be able to do: If arrays were implemented as a class, then I could subclass them with something that I was tentatively calling an arrayView class. The arrayView is constructed from an existing array, a stride, an offset, and a length. The new class only need override the array get and set element methods, inheriting all remaining operations. The goal is that an arrayView can be used by any function/method that requires an array. The application that motivated the above idea is a lifting-scheme based wavelet transform I have written for my research. This algorithm requires splitting the input into evens and odds, altering each even/odd sub-array, then recursing on each sub-array. The implementation in OCaml (actually, I'm using OLabl) presently requires that I use a while loop. (not quite back to Fortran IV, but...;-) A for-statement with step would clean things up somewhat. Finally, I think that the ability to create an arrayView class like I describe would be a useful step for exploring the practice of the OO and "core Caml" features. IMHO, languages that support classes but lack a standard class library aren't really "object-oriented" in an important sense. In OCaml's case, I suspect that the lack of a standard library has inhibited exploration of OO-style in OCaml. -- John