Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving record fields using all specified fields #5525

Closed
vicuna opened this issue Mar 7, 2012 · 2 comments
Closed

Resolving record fields using all specified fields #5525

vicuna opened this issue Mar 7, 2012 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Mar 7, 2012

Original bug ID: 5525
Reporter: @alainfrisch
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2015-12-11T18:25:43Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 4.01.0+dev
Category: typing
Related to: #4172 #5528
Child of: #5759
Monitored by: @gasche tgazagna @diml pveber @ygrek @hcarty

Bug description

With punning on record labels, programmers have a stronger incentive to use nice short names for record labels and avoid the disambiguation-by-prefixing technique.

The following proposal would make it possible, in some cases, to work with several record types that share some field names: when typing a record literal {[e0 with] l1 = e1; ... ; ln = en} or a record pattern {l1 = p1; ...; ln = pn}, the type-checker would search the current typing environment for a record type declaration that includes all the fields {l1, ..., ln}.

This cannot break existing well-typed code.

We have been using this modified resolution at LexiFi for a few years now. The patch is tiny. I can adapt it to the OCaml trunk if the proposal is accepted.

@vicuna
Copy link
Author

vicuna commented Dec 4, 2012

Comment author: @alainfrisch

Included in the record_disambiguation branch (#5759).

@vicuna
Copy link
Author

vicuna commented Dec 7, 2012

Comment author: @garrigue

Included in the branch record-disambiguation, which was merged into trunk on 2012-12-06, at revision 13112.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants