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 WAA20653; Thu, 22 Aug 2002 22:45:18 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA20654 for ; Thu, 22 Aug 2002 22:45:17 +0200 (MET DST) Received: from hirsch.in-berlin.de (hirsch.in-berlin.de [192.109.42.6]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g7MKjGr05566 for ; Thu, 22 Aug 2002 22:45:17 +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 g7MKjGv6001534 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NOT); Thu, 22 Aug 2002 22:45:16 +0200 Received: (from uucp@localhost) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with UUCP id g7MKj1Ot001353; Thu, 22 Aug 2002 22:45:01 +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 WAA00648; Thu, 22 Aug 2002 22:40:54 +0200 Date: Thu, 22 Aug 2002 22:40:53 +0200 (MET DST) From: Oliver Bandel To: Markus Mottl cc: Oleg , caml-list@inria.fr Subject: Re: [Caml-list] Calling a function with a self-defined type as argument In-Reply-To: <20020822131519.GA32496@bach.ai.univie.ac.at> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello Markus, On Thu, 22 Aug 2002, Markus Mottl wrote: > Oliver Bandel schrieb am Thursday, den 22. August 2002: > > But the Line ("text")-argument is only complete as a Line(), > > if Line() has a higher priority than the function-call. > > I have *one* argument, which is complete if given EMPTY, > > and complete if given Line ("argument"). > > The parser attempts to parse arguments of a function call, all of > which must be expressions. "Line" is not an expression, it's just a > data constructor. To disambiguate things, you have to use parentheses. > Note that your proposal that the compiler should use type definitions > to see how many arguments constructors take would make sources really > unreadable for humans. Things are perfect as they are. OK, I believe it you. I'm the beginner in Ocaml, not you. ;-) I have to program more in Ocaml, then I will see how it works. After looking again on my sources (the one I mailed to the list) I found some other things, I could do better, e.g. not use Empty_Line for Line "", because it does not help much, but yields some problems. All in all I see, that I have some problems with Ocaml, because I have not used it very often. But even after this short time of using functional programming (I looked a littlebid into it and then made a pause, looked again in and made a pause) I'm very annoyed, when I use imperative programming. E.G. the reading of the lines and comparing them with my ad-hoc parsing is really annoying, especially, when I want to put the read text into an array of strings or array of objects... ...when programming in the usual C-like style, I'm now constantly annoyed. I will try some more functional ideas and use recursion instead of loops. I hope that helps. [...] > It may be clear here but not always. Even if things can be tractably > analyzed by an intelligent compiler, you still need to enforce readability > of sources. It would be absolute hell to let people parse such programs, > because they'd constantly have to look up type definitions in other > places to parse things correctly. Not a problem for a compiler - huge > problem for humans! OK. I maybe one day will see the advantages. ;-) 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