From: Wolfgang Lux <lux@wi.uni-muenster.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] ocaml and named constants
Date: Wed, 30 May 2001 11:46:37 +0200 [thread overview]
Message-ID: <200105300946.f4U9kdv21524@concorde.inria.fr> (raw)
In-Reply-To: Message from John Max Skaller <skaller@ozemail.com.au> of "Wed, 30 May 2001 03:16:52 +1000." <3B13D984.A8CAF922@ozemail.com.au>
John Max Skaller wrote
> Unless you use a 'when' construct .. which already
> provides what I was asking for. The case when this is most
> annoying is for 'manifest constants':
>
> let c1 = 1
> and c2 = 2
> in match expr with
> | x when x = c1 -> ..
> | x when x = c2 -> ..
>
Maybe it's time to ask for a little syntax extension, viz. to allow for
multiple when clauses in a pattern matching. (This is similar to what
is allowed e.g. in Haskell already.) Thus the above matching could be
rewritten as:
match expr with
| x when x = c1 -> ..
when x = c2 -> ..
The syntax for pattern matchings would have to be changed as follows:
<pattern-matching> ::= ["|"] <case> { "|" <case> }
<case> ::= <pattern> "->" <expr>
| "when" <expr> "->" <expr> { "when" <expr> "->" <expr> }
And a similar change would apply to <multiple-matching>.
Wolfgang Lux
--
Wolfgang Lux Phone: +49-251-83-38263
Institut fuer Wirtschaftinformatik FAX: +49-251-83-38259
Universitaet Muenster Email: wlux@uni-muenster.de
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-05-30 11:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-23 17:06 David Fox
2001-05-28 12:32 ` Xavier Leroy
2001-05-29 1:07 ` John Max Skaller
2001-05-29 12:12 ` Andreas Rossberg
2001-05-29 17:16 ` John Max Skaller
[not found] ` <skaller@ozemail.com.au>
2001-05-30 9:46 ` Wolfgang Lux [this message]
2001-05-29 13:50 ` Luc Maranget
2001-05-30 16:50 ` Brian Rogoff
2001-05-31 9:22 ` Luc Maranget
2001-05-31 16:34 ` Brian Rogoff
2001-06-01 4:39 ` David Fox
2001-06-01 1:45 ` John Max Skaller
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=200105300946.f4U9kdv21524@concorde.inria.fr \
--to=lux@wi.uni-muenster.de \
--cc=caml-list@inria.fr \
--cc=wlux@uni-muenster.de \
/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