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

toplevel: do not print full module path for record fields except the first one #5722

Closed
vicuna opened this issue Aug 7, 2012 · 3 comments
Closed
Assignees

Comments

@vicuna
Copy link

vicuna commented Aug 7, 2012

Original bug ID: 5722
Reporter: @ygrek
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2015-12-11T18:07:58Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 4.00.0
Fixed in version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @bobzhang @hcarty

Bug description

Consider :
module X = struct type t = { a : int; b : int; c : Complex.t; } end;;

Currently:

{ X.a = 1; b = 2; c = Complex.one; };;

  • : X.t = {X.a = 1; X.b = 2; X.c = {Complex.re = 1.; Complex.im = 0.}}

With the patch :

{ X.a = 1; b = 2; c = Complex.one; };;

  • : X.t = {X.a = 1; b = 2; c = {Complex.re = 1.; im = 0.}}

Additional information

The reason for this simple patch is to improve readability especially for deeply nested modules

File attachments

@vicuna
Copy link
Author

vicuna commented Aug 14, 2012

Comment author: @garrigue

This is perfectly reasonable, as record parsing allows qualifying only one of the labels.
And the patch is wonderfully short.
I plan to apply it immediately to trunk.
Shall we use it in 4.00 too ?
The only side-effect I foresee may be some change in test outputs.

@vicuna
Copy link
Author

vicuna commented Aug 14, 2012

Comment author: @hcarty

As a frequent toplevel user, I would love to see this patch in 4.00.x.

@vicuna
Copy link
Author

vicuna commented Aug 14, 2012

Comment author: @garrigue

Implemented the requested behavior in genprintval.ml rather than oprint.ml.
Committed in trunk revision 12861, waiting for 4.00.

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