Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004648OCamlOCaml generalpublic2008-11-17 23:082011-06-04 09:32
Reportermottl 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.11.0+beta 
Target VersionFixed in Version3.12.0 
Summary0004648: Syntax improvement for easier binding of record fields
DescriptionIt seems to be one of the more frequent annoyances concerning OCaml syntax that record fields can only be bound/matched explicitly, e.g. in the following way:

  let { Foo. some_long_name = some_long_name; b = b } = my_rec in ...

Unless I'm seriously mistaken, it should be very easy to support the following:

  let { Foo. some_long_name; b } = my_rec in ...

Especially in cases where there are many record fields and long names this would substantially reduce the effort of extracting/matching records.

This feature wouldn't require any new keywords, wouldn't break existing code, looks very intuitive (AFAIK, SML supports something of that sort), and should be straightforward to implement.

Could you please consider this for inclusion in a future OCaml-release?
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0004772)
oandrieu (reporter)
2008-11-21 14:05

FYI, I did a camlp4 syntax extension doing exactly this a couple years ago: http://oandrieu.nerim.net/ocaml/#pa_records [^]
(/!\ it's not a 3.10-camlp4 extension)

It's useful in record expression too (when building a record):

  let b = ... in
  let some_long_name = ... in
  { some_long_name ; b }
(0004773)
mottl (reporter)
2008-11-21 15:35

Right, record construction should, of course, be treated in the same uniform way, too.
(0005963)
Christophe Troestler (reporter)
2011-06-02 22:39

Shouldn't this be closed? The requested feature is indeed available in 3.12.
(0005966)
xleroy (administrator)
2011-06-04 09:32

Christophe is right: this wish was granted in 3.12.0. Closing the PR.

- Issue History
Date Modified Username Field Change
2008-11-17 23:08 mottl New Issue
2008-11-21 14:05 oandrieu Note Added: 0004772
2008-11-21 15:35 mottl Note Added: 0004773
2008-12-03 14:12 doligez Status new => acknowledged
2011-06-02 22:39 Christophe Troestler Note Added: 0005963
2011-06-04 09:32 xleroy Note Added: 0005966
2011-06-04 09:32 xleroy Status acknowledged => closed
2011-06-04 09:32 xleroy Resolution open => fixed
2011-06-04 09:32 xleroy Fixed in Version => 3.12.0


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker