tags:

views:

127

answers:

2

When people refer to the "revised syntax" in OCaml, do they mean that this will become a new syntax for the language, or is it just an alternative syntax created in CamlP4? If it's the former, then when does the "revised syntax" become the "official syntax" of OCaml?

+2  A: 

This is just an alternative concrete syntax. I think that's just to demonstrate how powerful camlP4 is, a kind of proof of concept.

LB
It is not a proof of concept - it covers all the features of the language as the original one.
ygrek
that's just a proof of the concept that you can have several concrete syntaxs. That was what i meant... because i don't think many people are actually using the revised syntax.
LB
+8  A: 

The revised syntax is just an alternative to the original that is implemented in Camlp4/5 (there is also a Lisp syntax written in Camlp5). Some people prefer it, but I would discourage you from using it as it's only likely to make your code more confusing for other OCaml programmers. One place it's valuable to know the revised syntax is when you're writing Camlp4/5 extensions---the revised syntax is used for patterns and rewrites, probably because it's somewhat more consistent than the original.

As far as I know, there is no plan to replace the original OCaml syntax with the revised syntax.

Chris Conway
"but I would discourage you from using it as its only likely to make your code more confusing for other OCaml programmers" - he he, then you better discourage using ocaml at all, as it will confuse far more people :)). Anyway, you can write quotations with original syntax, but there are some cases which cannot be expressed in original syntax, so revised is usually preferred for that task. As for usual programming - revised syntax is arguably more logical and easier for newbies (thats why it exists after all) - without many ambiguities of the original one.
ygrek
ygrek, I make no representation about which syntax is better. I do think a small- to medium-sized community like OCaml's should work hard not to fragment around dialects.
Chris Conway
Another point against revised syntax: poor(er) editor support. Neither Tuareg nor Vim's OCaml facilities support it to my knowledge.
Michael E