Browse thread
How to do this properly with OCaml?
-
Thomas Fischbacher
- Christophe Dehlinger
- Berke Durak
- Michel Quercia
- Eric Cooper
-
Michael Alexander Hamburg
-
Xavier Leroy
- Berke Durak
- Michael Alexander Hamburg
- Thomas Fischbacher
- Alex Baretta
-
skaller
- Stephane Glondu
- Ken Rose
- Thomas Fischbacher
-
Xavier Leroy
[
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: | Thomas Fischbacher <Thomas.Fischbacher@P...> |
| Subject: | Re: [Caml-list] How to do this properly with OCaml? |
On Thu, 28 Jul 2005, skaller wrote: > I'm not arguing "I don't like this approach". I already know > of several ways to do variable length arrays, you haven't > shown me anything new: it seems you're simply not accepting > my assertion: it isn't possible to do it efficiently > in Ocaml without magic: either Obj.magic or C code with > an Ocaml interface: both solutions are fragile and > require secret knowledge of ocaml implementation. Plus keeping fingers crossed that major compiler changes will not break those implementations. (What if, at one point, GC would start making extra homogeneity assumptions over arrays - if it does not do so already?) > Thus, to safely use variable length arrays they > have to be provided by INRIA. That doesn't imply > they *should* be provided by INRIA of course. > I can always use a different data structure, > ignore safety, or use another programming language. First of all, it certainly would be nice if OCaml provided more flexible arrays. There are specialized applications where it really is a pain having to emulate them manually, and especially if it's about numerics, extra consing / indirection often have to be reduced to a minimum. I originally was somewhat worried whether extensible arrays really would be such a dramatic improvement - what if the next person needs displaced arrays, or any other functionality from CL's arrays with their many bells, gongs, and whistles? But thinking a bit more about it, it seems as if virtually anything of interest could be accomplished by other means, with the exception of just extensible arrays. -- regards, tf@cip.physik.uni-muenchen.de (o_ Thomas Fischbacher - http://www.cip.physik.uni-muenchen.de/~tf //\ (lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y) V_/_ (if (= x 0) y (g g (- x 1) (* x y)))) n 1)) (Debian GNU)