This site is updated infrequently. For up-to-date information, please visit the new OCaml website at ocaml.org.

[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
```On Sat, 13 Apr 2002, William Chesters wrote:
> Issac Trotts writes:
>  > as a frequently discuseed topic.

feature by some (including me!) and a much less desired feature by others.
but you don't get overloading. Try out G'Caml if you want to get the
flavor of the proposed Caml approach. It's experimental, and I doubt it
will be merged in the main branch anyime soon.

>  > Still I didn't find anything
>  > very useful in the posts that Google brought up.  Can anyone
>  > recommend a way to work around OCaml's lack of operator overloading
>  > when dealing with matrices, vectors, and spinors?  Is there a
>  > way to implement this with ocamlp4?
>
> Do you really want overloading for this purpose?  If it's just for
> cosmetic purposes, like being able to write
>
>       z := A * x + y
>
> where x y z are vectors and A a matrix, then I for one am happy with
>
>       z |:=| A %*| x |+| y
>
> (where %*| means matrix-times-vector, etc.).

I guess there really is no accounting for taste! ;-)

> At least you get to see what's really going on.

The whole point of abstraction is to forget about what's really going on.

Anyways, there are a number of places, besides linear algebra, where
some kind of overloading is (arguably of course) desirable. In the FP
world, you'll have to go to Haskell or Clean if this kind of thing
is what you desire. Personally, I do desire it, but I think strict
languages are better than lazy ones, and that that is a more important

Certainly, C++ is not what I'm thinking about when I'm thinking nice
mixed.

>    To my mind a more important limitation of ocaml is that it can't
> do inlining across module boundaries, which means that the
> possibilities for coding generic (as opposed to overloaded!)
> algorithms using the functor/module system are often made less