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

change 12-tuples in typing/typeclass.mli into records for readability #7237

Closed
vicuna opened this Issue Apr 20, 2016 · 6 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Apr 20, 2016

Original bug ID: 7237
Reporter: @gasche
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2017-09-24T15:32:53Z)
Resolution: fixed
Priority: low
Severity: tweak
Version: 4.03.1+dev
Target version: 4.03.1+dev
Fixed in version: 4.04.0 +dev / +beta1 / +beta2
Category: ~DO NOT USE (was: OCaml general)
Tags: junior_job
Monitored by: @yallop @hcarty

Bug description

The very large tuples in the typeclass.mli interface (this code type-checks class declarations in particular)

https://github.com/ocaml/ocaml/blob/5401ce8/typing/typeclass.mli

could be turned into records with named fields to make code manipulating them more readable.

A good way to get started would be to look at the variable names used in the implementation, for example check_coercions in

https://github.com/ocaml/ocaml/blob/5401ce8/typing/typeclass.ml#L1592-L1593

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Apr 27, 2016

Comment author: junsli

Aside:

I noticed the typedtree.ml has class_description and class_type_declaration being defined as the same thing. git blame doesn't show useful historical reason for this.

and class_description =
class_type class_infos

and class_type_declaration =
class_type class_infos

12-tuple in typeclass.mli uses both of them.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Apr 27, 2016

Comment author: @gasche

These two notions correspond to distinct source syntaxes (see below), but at the typing stage they carry the exact same information. The distinction between both is not very useful, but it has a meaning: to test which one to use, you should think of which of the two concrete language constructions is being manipulated.

In parsing/parsetree.mli:

| Psig_class of class_description list
(* class c1 : ... and ... and cn : ... )
| Psig_class_type of class_type_declaration list
(
class type ct1 = ... and ... and ctn = ... *)

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Apr 27, 2016

Comment author: junsli

Thanks. That makes sense now. I actually appreciate this deliberate duplicate.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Apr 30, 2016

Comment author: junsli

See #570

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Apr 30, 2016

Comment author: @gasche

( #570 )

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented May 11, 2016

Comment author: @gasche

#570 was merged in trunk, so this problem is solved by junsli's patch. Thanks!

@vicuna vicuna closed this Sep 24, 2017

@vicuna vicuna added the junior-job label Mar 14, 2019

@vicuna vicuna added this to the 4.03.1 milestone Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.