RE: Looking for a nail

From: John Whitley (
Date: Sun Jan 31 1999 - 19:43:12 MET

From: John Whitley <>
Date: Sun, 31 Jan 1999 13:43:12 -0500 (EST)
Subject: RE: Looking for a nail
In-Reply-To: <39ADCF833E74D111A2D700805F1951EF0F00B93A@RED-MSG-06>

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

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

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:19 MET