[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Whitley <whitley@c...> |
| Subject: | RE: Looking for a nail |
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