Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Label Names Space - philosophy or implementation?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andrew Conway <arc@s...>
Subject: Re: Label Names Space - philosophy or implementation?

[ Francais: Il y a quelques choses (dessous) que je n'aime pas avec ocaml, 
            mais, les autres langues ont des plus grands problemes. ]

> > A co-worker has (vehemently) pointed out to me that record label names

I agree with the vehemently part.

This is an annoyance which I have frequently run into. 

> Its a common habit to prefix the labels with the name of the type:

That is an ugly hack to work around a problem with the language.

Don't get me wrong, I think that, all in all, ocaml is my favourite
language, and I am very greatful to you for making it. The fact that 
something is the best doesn't mean that it couldn't be better, however, 
so it is about time for me to reorder my current list of annoyances.

Below is a list of the common mistakes I make in CAML that
I don't make in other languages, or annoyances that I have with CAML. The
list is ordered, most annoying coming first. Many of these have been mentioned
by other people before; I am just adding support.

1) Writing "+" instead of "+."
     [ I know this is effectively intractable, and I am willing to put
       up with it. It is, however, my major source of type mistakes when
       I am doing numeric work. ]

2) Putting an extra semicolon before a "done" or "end" statement

     [ This is especially annoying when adding a line after the last line,
       such as a debugging printf statement, or re-ordering lines. ]

3) I have written my own library of (amongst other things) standard list
   and array manipulation routines, in modules Mylist and Myarray. If I
   want a function such as map2 on lists, I type in List.map2. If I
   want an analagous function on arrays, I do Myarray.map2. Frequently I
   mistakenly do Array.map2 instead, remembering that it is defined for
   arrays, and since it is in the standard library for List, it is also
   in the standard library for arrays. I appreciate the reasons why these
   are not symmetyric, but it would be nice if it were possible to merge
   modules, so that I could refer to my own libraries through the List
   or Array modules.

4) Using a record label twice

5) Annoyance: one can make a custon toplevel, linking in custom code
   to manipulate ones own datatypes. This is really useful. However,
   one cannot link in a command to automatically use a prettyprinter,
   and this command has to be done by hand. Having a startup script
   would be really useful.
6) There is no deep copy.

7) One cannot use ocamlopt compiled routines in camltop, though one can use
   C routines. I realise that the memory allocation register usage makes
   this difficult. On the other hand, a few days ago, I was considering 
   rewriting some matrix manipulation routines in C instead of ocaml,
   so that I could run them at a reasonable speed under ocamltop, even
   though they ran acceptably quickly when compiled by ocamlopt. Then it 
   suddenly dawned on me that it seemed a little silly to convert something 
   FROM ocaml to make it easier to work WITH ocaml.

Anyway, I should again say that these are, of course, just annoyances, 
and I still really like the language. However, having you aware that they
are frustrations can't hurt.

Thanks again,