caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Evgeny Roubinchtein <zhenya1007@gmail.com>
To: Toby Kelsey <toby.kelsey@gmail.com>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Are record types generative?
Date: Fri, 2 Feb 2018 15:23:58 -0800	[thread overview]
Message-ID: <CAGYXaSaUpdpbpcJ5UV0Hs7RJPfo5X95BqOS3sWqPriPsTRGY7w@mail.gmail.com> (raw)
In-Reply-To: <2e9462f5-4042-230f-104b-943f1e2ebe76@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1510 bytes --]

One source that explains how record labels are disambiguated is:
https://realworldocaml.org/v1/en/html/records.html#reusing-field-names.

Parenthetically, it seems to me that your question is hardly related to the
subject of this thread, so it may have been better to start a new thread in
this case, than to piggy-back onto an existing thread.

-- 
Best,
Evgeny ("Zhenya")

On Fri, Feb 2, 2018 at 3:07 PM, Toby Kelsey <toby.kelsey@gmail.com> wrote:

> On 24/01/18 08:43, Jacques Garrigue wrote:
>
>> I.e., types can be used to optimize a program, but they do not change its
>> semantics.
>> It’s true of so-called “overloaded” record labels, it’s true of a labeled
>> and default arguments
>> (which use type information for compilation, but not semantics), it’s
>> true of objects,
>>   it’s true of GADT pattern-matching (again optimized), etc…
>>
>
> type foo = { x : int }
> type bar = { x : string }
>
> let f r = r.x           (* OK: uses bar *)
> let f r = (r:foo).x  (* OK: uses foo *)
> let f r = (r.x : int) (* type error - wrong type inferred *)
>
>
> Aren't the semantics different? 'f' has different types in the first two
> definitions, And why does type inference fail for the last example?
>
> Toby
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

[-- Attachment #2: Type: text/html, Size: 2530 bytes --]

  reply	other threads:[~2018-02-02 23:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 14:54 Oleg
2018-01-23 16:05 ` Jeremy Yallop
2018-01-23 17:39   ` Chet Murthy
2018-01-23 20:35     ` Jeremy Yallop
2018-01-23 21:36       ` Chet Murthy
2018-01-23 22:06         ` Jeremy Yallop
2018-01-23 23:14           ` Hendrik Boom
2018-01-24  1:06             ` Chet Murthy
2018-01-24  1:35             ` Francois BERENGER
2018-02-07  2:00               ` [Caml-list] [ANN] first release of bst: a bisector tree implementation Francois BERENGER
2018-02-07 12:40                 ` Ivan Gotovchits
2018-02-08  0:46                   ` Francois BERENGER
2018-01-24  1:56             ` [Caml-list] Are record types generative? Yawar Amin
2018-01-25 10:49               ` Matej Košík
2018-01-25 13:39                 ` Simon Cruanes
2018-01-25 16:24                 ` Yawar Amin
2018-01-24  1:05           ` Chet Murthy
2018-01-24  8:43             ` Jacques Garrigue
2018-02-02 23:07               ` Toby Kelsey
2018-02-02 23:23                 ` Evgeny Roubinchtein [this message]
2018-02-04  1:27                 ` Jacques Garrigue

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=CAGYXaSaUpdpbpcJ5UV0Hs7RJPfo5X95BqOS3sWqPriPsTRGY7w@mail.gmail.com \
    --to=zhenya1007@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=toby.kelsey@gmail.com \
    /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).