From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id TAA05877 for caml-redistribution; Thu, 25 Jul 1996 19:18:18 +0200 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id TAA05775 for caml-list; Thu, 25 Jul 1996 19:14:26 +0200 From: Pierre Weis Message-Id: <199607251714.TAA05775@pauillac.inria.fr> Subject: Re: Language improvements (?) To: caml-list@pauillac.inria.fr Date: Thu, 25 Jul 1996 19:14:25 +0200 (MET DST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: weis Date: Thu, 25 Jul 1996 20:14:18 +0900 From: christo@nextsolution.co.jp (Frank Christoph) Message-Id: <9607251114.AA00849@sparc3.nextsolution.co.jp> To: caml-list@pauillac.inria.fr In-Reply-To: <199607250212.TAA04865@kronstadt.rahul.net> (message from Ian T Zimmerman on Wed, 24 Jul 1996 19:12:38 -0700) Subject: Re: Language improvements (?) [ Mode'rator's Note: Hi, Please note that from today to August the 26th, no messages from the Caml mailing list will be sent (vacations). Sorry for the inconvenience, Pierre Weis ] >>>>> "Ian" == Ian T Zimmerman writes: > Hmm, I sincerely hope the Caml team will _not_ follow this suggestion, or at > the very least leaves an escape in the form of a compiler switch for those > of us who dislike it. > It is a religious issue, and I see little point in repating the arguments > made many times before in comp.compilers, among other places. I recognize > the points of the other side, but this would be a fundamental change in how > the language `looks and feels' and so I think prudence should prevail and > scoping by keywords should be preserved. I agree 100%. It's far too late for such a fundamental change; implementing it in O'Caml would be rash and injudicious, and would probably take it completely out of the realm of ML itself. So, uh, let's change the name of the language. Yeah, that's it. How about, oh, I dunno, "The-Language-Formerly-Known-As-Objective ML"? :) No, seriously though, I don't expect such a drastic change at this point. I was just, shall we say, daydreaming? Besides, I have a hundred *other* syntactical improvements to suggest. Now where was that list ... ? OK, OK -- I can see everyone starting to moan already. But I do have one humble little question concerning syntax and conventional practice in the Caml world. O'Caml seems to lack a succinct way of defining functions that pattern-match multiple arguments. For example, suppose I wanted to define a function to exclusive-OR the integers 1 and 0 without using the wildcard "_". In Haskell, I could write xor 1 1 = 0 xor 0 1 = 1 xor 1 0 = 1 xor 0 0 = 0 and apparently in SML it is possible to write fun xor 1 1 = 0 | xor 0 1 = 1 | xor 1 0 = 1 | xor 0 0 = 0 but, as far as I can tell, there is no simple way to do this in O'Caml. If I write let xor 1 1 = 0 and xor 1 0 = 1 and xor 0 1 = 1 and xor 0 0 = 0 I get a duplicate binding error. If I try let xor = fun ... or let xor = function ... then I need to nest pattern-matching constructs. Is there a pattern-matching construct like the Haskell and SML examples I gave in O'Caml? (Did I miss it?) Or is there some reason why it has been left out? I know that compiling pattern-matches perfectly isn't possible because it requires parallel evaluation of arguments. Is this why there is no such construct, to force users to choose an evaluation order? But then, "fun x y ..." is parallel. (Granted, there is an O'Caml convention for its evaluation.) ------------------------------------------------------------------------ Frank Christoph Next Solution Co. Tel: 0424-98-1811 christo@nextsolution.co.jp Fax: 0424-98-1500