From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA14727; Mon, 30 Aug 2004 09:13:01 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA15782; Mon, 30 Aug 2004 09:13:00 +0200 (MET DST) Received: from grisu.bik-gmbh.de (grisu.bik-gmbh.de [217.110.154.194]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i7U7CxI3000923 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 30 Aug 2004 09:12:59 +0200 Received: from [192.168.125.193] ([192.168.125.193]) by grisu.bik-gmbh.de (8.12.8p2/8.12.8) with ESMTP id i7U7Co1w025217; Mon, 30 Aug 2004 09:12:50 +0200 (CEST) (envelope-from hars@bik-gmbh.de) Message-ID: <4132D36D.4020104@bik-gmbh.de> Date: Mon, 30 Aug 2004 09:12:45 +0200 From: Florian Hars Reply-To: caml-list@pauillac.inria.fr User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: de, de-de, en-us, en MIME-Version: 1.0 To: briand@aracnet.com CC: caml-bugs@inria.fr, caml-list@pauillac.inria.fr Subject: Baffeld by manual (Was: [Caml-list] baffled by semicolon) References: <16685.22393.76718.150882@soggy.deldotd.com> In-Reply-To: <16685.22393.76718.150882@soggy.deldotd.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-2.1 required=5.0 tests=EMAIL_ATTRIBUTION,IN_REP_TO,REFERENCES,REPLY_WITH_QUOTES, USER_AGENT_MOZILLA_UA,X_ACCEPT_LANG version=2.55 X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) X-Miltered: at nez-perce with ID 4132D37B.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; florian:01 hars:01 hars:01 bik-gmbh:01 caml-list:01 baffled:01 semicolon:01 bug:01 expr:01 expr:01 ingenuity:01 semicolon:01 ignores:01 florian:01 evaluates:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk briand@aracnet.com wrote: > I went back through the manual and really couldn't find anything which > explained the difference between ; and ;; Yeah, this is a bug in section 1.5 "Imperative Features" of the manual. (IMHO, the whole Part I is not what it claims to be and the Ocaml team should stop calling it an introduction into the language, but I've said that before http://caml.inria.fr/archives/200210/msg00451.html) Now, if you want to be anal, you might say that all that needs to be said is indeed said in the manual, in section 6.7.2 "Control Structures" | The expression expr1 ; expr2 evaluates expr1 first, then expr2, and returns | the value of expr2. together with section 6.11.2 "Structures": | For compatibility with toplevel phrases (chapter 9) and with Caml Light, an | optional ;; is allowed after each definition in a structure. The ;; has no | semantic meaning. Also for compatibility, ;; expr is allowed as a component | of a structure, meaning let _ = expr, i.e. evaluate expr for its | side-effects. But to find this section (and to see why it is indeed the answer to your question) requires some ingenuity, since you are not dealing with a structure proper, but with a compilation unit, and section 6.12 doesn't mention this peculiarity. You have to guess its relevance from the "behaves roughly as". With this knoledge, you can see let your version with a single semicolon > let w = area#misc#realize (); > area#misc#window;; is equivalent to the definition: let w = let _ = area#misc#realize () in area#misc#window while the version with the double semicolon is let w = area.misc.realize () let _ = area#misc#window which binds w to unit and ignores the value of area#misc#window. Yours, Florian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners