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 OAA12121; Thu, 22 Aug 2002 14:55:05 +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 OAA12252 for ; Thu, 22 Aug 2002 14:55:04 +0200 (MET DST) Received: from hirsch.in-berlin.de (hirsch.in-berlin.de [192.109.42.6]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g7MCt3X20688 for ; Thu, 22 Aug 2002 14:55:03 +0200 (MET DST) Received: from hirsch.in-berlin.de (localhost [127.0.0.1]) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with ESMTP id g7MCt3W0010047 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NOT); Thu, 22 Aug 2002 14:55:03 +0200 Received: (from uucp@localhost) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with UUCP id g7MCt2m2010045; Thu, 22 Aug 2002 14:55:02 +0200 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: caml-list@inria.fr Received: from localhost (oliver@localhost) by first.in-berlin.de (8.7.6/8.7.3) with SMTP id OAA00786; Thu, 22 Aug 2002 14:47:27 +0200 Date: Thu, 22 Aug 2002 14:47:26 +0200 (MET DST) From: Oliver Bandel To: Dimitri Ara cc: caml-list@inria.fr Subject: Re: [Caml-list] Calling a function with a self-defined type as argument In-Reply-To: <87y9azy7h3.fsf@corwin.mutu.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On 22 Aug 2002, Dimitri Ara wrote: > Oliver Bandel a écrit : > > > (* > > let _ = x Line "h0oifdaji oi" ;; > > This last one does not work: => "This function is applied to too many arguments" > > > > let _ = x Line( "reuruhjf" ) ;; > > This last one does not work: => "This function is applied to too many arguments" > > > > But it works in this way: > > let _ = x (Line "reuruhjf") ;; > > > > WHY? (why *only* that?) > > > > At least the second example (with parantheses around the > > Line's arguments) should work...?! > > *) > > Because : > > (1) application is left associative. > > Thus `f x y' means `(f x) y' and > `x Line ""' means `(x Line) ""'. > > (2) parentheses don't delimit the arguments of a function or a > constructor but only fix the precedence of an expression. > > Thus f x (y) means f x y and > `x Line ("")' means `x Line ""'. OK. But why has the Line()-argument not a higher pruiority than the function-call? The Line()-argument is only complete, if it get's it's args. And the type-declaration says in detail, how to handle the Line(). But it seems to me that it is handled like an "ordinary" function call. I thought, that the compiler would put this together: *one* argument to the function, and the argument means using the type `Line "text"'. Ciao, Oliver ------------------- 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