Browse thread
Re: Syntax for label, NEW PROPOSAL
- Markus Mottl
[
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: | Markus Mottl <mottl@m...> |
| Subject: | Re: Syntax for label, NEW PROPOSAL |
> -- Problem1: labels can be reserved keywords. This is questionable > and it has been strongly criticised by some Caml users, especially when > reading in the code the awful sequence fun:begin fun ... Although this is a bit off-topic, I would also like to point out some identifier problems with polymorphic variants as they are implemented at the moment (maybe this could also be changed before the major release): First of all, the initial quote ` can be followed by whitespace - and worse: by comments! I feel that this is really somewhat insane, even if most users won't use polymorphic variants like this. Secondly, I am not sure whether it is such a good idea to allow lowercase initial letters. They can sometimes clash with keywords and here they really do, because (see above) of they way they are parsed. This can lead to syntax errors which will surely confuse beginners (and also confused me once...). If parsing were changed, this wouldn't be a problem anymore, but I think that the relation between normal variants and polymorphic ones should stay evident - having to use capitals for the first letter with both of them seems more regular to me. > -- Problem2: labels that spread all over the standard libraries, even > when they do not add any good. I would cite: > > * labels that prevent you to use comfortably your traditional functions. > This is particularly evident for the List.map or List.fold_right > higher-order functionals. I fully agree - labels in higher order functions make their application really a pain, especially if one wants to use curried functions. Being able to just pass the name of functions as argument is one of the major "features" of functional languages - it's probably not worse the extra type checking information to lose it. What concerns syntax: I would also rather prefer the version with ":"... > Do not forget the design decision that has always been used before in > the development of Caml: interesting but not universal extensions to > the language must carefully be kept orthogonal to the core language > and its libraries. This is an aspect I particularly like about OCaml - one can try out new styles of programming without being forced to use them throughout. Regards, Markus Mottl -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl