Skip to content

MPR#7237 change 12-tuples in typeclass into record.#570

Merged
gasche merged 2 commits intoocaml:trunkfrom
lijunsong:tuple2record
May 11, 2016
Merged

MPR#7237 change 12-tuples in typeclass into record.#570
gasche merged 2 commits intoocaml:trunkfrom
lijunsong:tuple2record

Conversation

@lijunsong
Copy link
Copy Markdown
Contributor

Are these field names appropriate?

@gasche
Copy link
Copy Markdown
Member

gasche commented Apr 30, 2016

@garrigue , what do you think of the choice of field names?

(I wondered if it would make sense to have pairs (id, declaration) instead of two fields, but the current proposal seems fine and incremental to me.)

@damiendoligez damiendoligez added this to the 4.04 milestone May 3, 2016
@lijunsong
Copy link
Copy Markdown
Contributor Author

Oh, since this is an internal change, I didn't update the change log. Please let me know if you also want an entry in the log.

@garrigue
Copy link
Copy Markdown
Contributor

garrigue commented May 8, 2016

Sorry I missed this discussion.
Yes, these field names look ok.
The code itself is fine, but I wonder why use let module T = Typeclass in rather than let open Typeclass in. I see no semantical problem in the latter.

@lijunsong
Copy link
Copy Markdown
Contributor Author

Thanks!

You actually got me. To be frank, I never did local open before, because I was afraid that open might introducing runtime penalty.

I re-read the manual, and it makes sense to me now that open only affects parsing. I really appreciate you ask this question :D

So, is local open preferred in this case? I'd like to change the code if so.

@gasche
Copy link
Copy Markdown
Member

gasche commented May 9, 2016

Sometimes we avoid open when there is a risk that it would hide a definition from the outer environment that is used in scope of the open. So open is preferred either at a very global level (when there are no values in the environment to hide) or at a very local level (when the expression under open is short and its references are easy to understand). Here, it would be a very local use, so it is perfectly fine.

(Amusingly, let module X = M in ... is the construction that had a (neglectible) performance impact in older OCaml versions, while let open M was always free.)

Yes, it is fine to use open in that case.

@lijunsong
Copy link
Copy Markdown
Contributor Author

@gasche Thanks for the clarifications! Updated.

@mshinwell
Copy link
Copy Markdown
Contributor

I actually think it would be better to use record field disambiguation and a type annotation on the function arguments of your new record type. See Flambda.

@gasche
Copy link
Copy Markdown
Member

gasche commented May 11, 2016

I decided to go ahead and merge the PR as-is: let open is consistent with the rest of the type-checker codebase (see use of let open Ast_helper in typecore and let open Variance in typedecl).

@lijunsong thanks for the patch! Next time, when you are making a small change to a proposed PR, do not hesitate to use an interactive rebase to squash the minor commits into the proposed commit, and git push -f to your private branch to refresh the pull-request.

@gasche gasche merged commit 201091a into ocaml:trunk May 11, 2016
@lijunsong
Copy link
Copy Markdown
Contributor Author

@gasche Thanks! I'll do next time.

@lijunsong lijunsong deleted the tuple2record branch May 12, 2016 00:57
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Mar 22, 2022
stedolan pushed a commit to stedolan/ocaml that referenced this pull request May 24, 2022
stedolan added a commit to stedolan/ocaml that referenced this pull request May 24, 2022
64235a3 flambda-backend: Change Float.nan from sNaN to qNaN (ocaml#466)
14a8e27 flambda-backend: Track GC work for all managed bigarray allocations (upstream 11022) (ocaml#569)
c3cda96 flambda-backend: Add two new methods to targetint for dwarf (ocaml#560)
e6f1fed flambda-backend: Handle arithmetic overflow in select_addr (ocaml#570)
dab7209 flambda-backend: Add Target_system to ocaml/utils (ocaml#542)
82d5044 flambda-backend: Enhance numbers.ml with more primitive types (ocaml#544)
216be99 flambda-backend: Fix flambda_o3 and flambda_oclassic attributes (ocaml#536)
4b56e07 flambda-backend: Test naked pointer root handling (ocaml#550)
40d69ce flambda-backend: Stop local function optimisation from moving code into function bodies; opaque_identity fixes for class compilation (ocaml#537)
f08ae58 flambda-backend: Implemented inlining history and use it inside inlining reports (ocaml#365)
ac496bf flambda-backend: Disable the local keyword in typing (ocaml#540)
7d46712 flambda-backend: Bugfix for Typedtree generation of arrow types (ocaml#539)
61a7b47 flambda-backend: Insert missing page table check in roots_nat.c (ocaml#541)
323bd36 flambda-backend: Compiler error when -disable-all-extensions and -extension are used (ocaml#534)
d8956b0 flambda-backend: Persistent environment and reproducibility (ocaml#533)
4a0c89f flambda-backend: Revert "Revert bswap PRs (480 and 482)" (ocaml#506)
7803705 flambda-backend: Cause a C warning when CAMLreturn is missing in C stubs. (ocaml#376)
6199db5 flambda-backend: Improve unboxing during cmm for Flambda (ocaml#295)
96b9e1b flambda-backend: Print diagnostics at runtime for Invalid (ocaml#530)
42ab88e flambda-backend: Disable bytecode compilers in ocamltest (ocaml#504)
58c72d5 flambda-backend: Backport ocaml#10595 from upstream/trunk (ocaml#471)
1010539 flambda-backend: Use C++ name mangling convention (ocaml#483)
81881bb flambda-backend: Local allocation test no longer relies on lifting (ocaml#525)
f5c4719 flambda-backend: Fix an assertion in Closure that breaks probes (ocaml#505)
c2cf2b2 flambda-backend: Add some missing command line arguments to ocamlnat (ocaml#499)

git-subtree-dir: ocaml
git-subtree-split: 64235a3
EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
Co-authored-by: Paul-Elliot <peada@free.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants