From: Anton Moscal <msk@post.tepkom.ru>
To: Xavier Leroy <Xavier.Leroy@inria.fr>
Cc: caml-list@inria.fr
Subject: Re: anonymous record types in variants
Date: Mon, 22 Feb 1999 11:44:32 +0300 (MSK) [thread overview]
Message-ID: <Pine.LNX.4.03.9902221137140.15888-100000@post.tepkom.ru> (raw)
In-Reply-To: <19990217103259.47130@pauillac.inria.fr>
On Wed, 17 Feb 1999, Xavier Leroy wrote:
> It could be implemented this way. However, if you declare the
> datatype as
>
> type foo = A of {lbl1 : int; lbl2 : int}
>
> you would be forced to pattern-match it as follows
>
> match x with A{lbl1 = x; lbl2 = y} -> ...
>
> but you can't get access to the record itself and use the dot notation
> on it, as in
>
> match x with A r -> ... r.x ... r.y ...
But why? Natural semantic for anonymous types is the following: each
anonymous record or algebraic types declaration introduces new type
declaration in the current scope with some temporary type name. I.e.
type ('a, 'b) foo = A of 'a * {l : 'b; l2: int}
is a shortcut for:
type ('a, 'b) temp_name = {l1 : 'b; l2: int}
and ('a, 'b) foo = A of 'a * ('a, 'b) temp_name
Regards,
Anton Moscal
next prev parent reply other threads:[~1999-02-22 13:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-02-12 20:53 Christopher Jeris
1999-02-16 10:57 ` Anton Moscal
1999-02-17 9:32 ` Xavier Leroy
1999-02-17 18:09 ` Christopher Jeris
1999-02-17 19:14 ` Didier Remy
1999-02-22 8:44 ` Anton Moscal [this message]
1999-02-22 13:00 ` Pierre Weis
1999-02-15 10:30 Don Syme
1999-02-15 18:03 Manuel Fahndrich
1999-02-16 17:40 Don Syme
1999-02-18 10:13 Frank A. Christoph
1999-02-18 14:03 Don Syme
1999-02-22 16:37 Manuel Fahndrich
1999-02-22 17:56 ` Pierre Weis
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=Pine.LNX.4.03.9902221137140.15888-100000@post.tepkom.ru \
--to=msk@post.tepkom.ru \
--cc=Xavier.Leroy@inria.fr \
--cc=caml-list@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