From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q04BkTXj001271 for ; Wed, 4 Jan 2012 12:46:29 +0100 X-IronPort-AV: E=Sophos;i="4.71,455,1320620400"; d="scan'208";a="137804537" Received: from walapai.inria.fr ([128.93.30.24]) by mail1-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Jan 2012 12:46:24 +0100 Received: from walapai.inria.fr (localhost [127.0.0.1]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q04BkOK6001268 for ; Wed, 4 Jan 2012 12:46:24 +0100 Received: (from sympa@localhost) by walapai.inria.fr (8.13.6/8.12.10/Submit) id q04BkNRf001267 for caml-list@inria.fr; Wed, 4 Jan 2012 12:46:23 +0100 Date: Wed, 4 Jan 2012 12:46:23 +0100 X-Authentication-Warning: walapai.inria.fr: sympa set sender to sympa@inria.fr using -f To: caml-list@inria.fr From: Jonathan Kimmitt In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: [Caml-list] "let" and "function" not redundant 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 ...