From: Pierre Weis <weis@pauillac.inria.fr>
To: caml-list@pauillac.inria.fr
Subject: Re: Language improvements (?)
Date: Thu, 25 Jul 1996 19:14:25 +0200 (MET DST) [thread overview]
Message-ID: <199607251714.TAA05775@pauillac.inria.fr> (raw)
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 <itz@rahul.net> 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
next reply other threads:[~1996-07-25 17:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-25 17:14 Pierre Weis [this message]
-- strict thread matches above, loose matches on Subject: below --
1996-07-24 6:30 Frank Christoph
1996-07-24 8:44 ` Pierre Weis
1996-07-24 9:53 ` Frank Christoph
1996-07-24 17:04 ` Georg Bauer
1996-07-25 2:12 ` Ian T Zimmerman
1996-07-25 12:26 ` Michel Mauny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199607251714.TAA05775@pauillac.inria.fr \
--to=weis@pauillac.inria.fr \
--cc=caml-list@pauillac.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).