From: Jacques GARRIGUE <garrigue@kurims.kyoto-u.ac.jp>
To: caml-list@pauillac.inria.fr
Subject: Re: Non-destructive record update??
Date: Fri, 17 Apr 1998 09:26:01 +0900 [thread overview]
Message-ID: <19980417092601H.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: Your message of "Thu, 16 Apr 1998 16:19:18 +0200 (MET DST)" <199804161419.QAA16455@pauillac.inria.fr>
From: Pierre Weis <Pierre.Weis@inria.fr>
Subject: Re: Non-destructive record update??
Date: Thu, 16 Apr 1998 16:19:18 +0200 (MET DST)
> We propose the notation {expr with label1 = e1; lable2 = e2 ... } to
> mean the record returned by the expression expr with fields label1,
> label2, ... set to values e1, e2, ...
As long as we are going to discuss syntax, I would suggest:
expr.{label1 = e1; label2 = e2; ...}
This is just a problem of parsing. With this definition you don't need
to change the production rules, just to add a
expr ::= expr "." record
case to the dot notation. I believe it is also compact and
intuitive. And everybody knows how "." associates to the left.
Right, I'm overloading "." with another (related) meaning, but "with"
is also used elsewhere in the language, and we cannot add keywords
forever.
By the way the with notation would need non-trivial changes in the
parser, since the natural rule produces an ambiguous grammar:
{ x = y; ... }
"x = y" may be parsed either as a field definition or as an
expression. If we parse it as an expression, then we are waiting for a
"with" clause, and end up with troubles. All right, no such expression
may return a record value, so in fact we might modify the definition:
{ simple expr with label1 = e1; ... }
But usually Caml's grammar do not put restriction on expressions
between brackets...
Jacques, a syntactic MLer
---------------------------------------------------------------------------
Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac.jp
<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>
prev parent reply other threads:[~1998-04-20 14:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-04-09 15:02 Caml sur Rhapsody Pierre Weis
1998-04-14 23:27 ` Non-destructive record update?? Donald Syme
1998-04-25 11:26 ` Christophe Raffalli
1998-04-16 14:19 ` Pierre Weis
1998-04-16 14:47 ` Pascal Brisset
1998-04-17 0:26 ` Jacques GARRIGUE [this message]
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=19980417092601H.garrigue@kurims.kyoto-u.ac.jp \
--to=garrigue@kurims.kyoto-u.ac.jp \
--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