Consider the following statement: type pet = Cats|Dogs|Rabbits of pet let list = List.map (function Cats -> "cats" | Dogs -> "dogs") [Cats;Dogs];;
for a human, it could be said the "let" and "function" are redundant but bearing in mind, to minimize CPU power and memory use, ocamlyacc will only look one symbol ahead to decide which grammar is intended, and in this case without the let it would not be clear whether Rabbits has type pet or type pet list. Likewise function which is not the same as fun if omitted would cause the function reference to end after Cats which result in a different kind of error. If the front-end was switched to a PEG parser such as teerex more flexibility would be possible but also more mysterious errors which would result in even more difficulty for beginners. If you want to do something useful, how about a program which automatically corrects beginner's syntax errors ? For example, by putting in missing keywords ... -- Caml-list mailing list. Subscription management and archives: https://sympa-roc.inria.fr/wws/info/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
