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

refactor(melange): move stanza definition #6775

Merged
merged 1 commit into from
Dec 27, 2022

Conversation

rgrinberg
Copy link
Member

It should exist in [Melange_stanzas]

Signed-off-by: Rudi Grinberg me@rgrinberg.com

ps-id: bee92f9b-6ded-4f47-b13a-25052ac6ff48

It should exist in [Melange_stanzas]

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: bee92f9b-6ded-4f47-b13a-25052ac6ff48
Copy link
Collaborator

@jchavarri jchavarri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I understand the benefits of this new approach. Also, Dune_project.Melange_syntax can prob be removed.

But otherwise looks good.

@@ -345,12 +345,6 @@ end

module Melange_syntax = struct
let name = "melange"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to leave just name here? The only consumer is Melange_stanzas.syntax, so maybe it could be moved to that module. Or even inlined in syntax definition.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish I could remove it but it has to stay because it's used to define the dialect for rescript.

@@ -2274,7 +2274,6 @@ type Stanza.t +=
| Cram of Cram_stanza.t
| Generate_sites_module of Generate_sites_module.t
| Plugin of Plugin.t
| Melange_emit of Melange_stanzas.Emit.t
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't this approach more exhaustive from a type checking perspective? What are the advantages of the new approach?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't this approach more exhaustive from a type checking perspective

I think it's equivalent. There's no exhaustiveness checking on open types no matter how you define their constructors.

What are the advantages of the new approach?

That we isolate the melange rules from the rest as much as possible. This should make it easy for us to change things without impacting the rest of the code base.

@rgrinberg rgrinberg merged commit 2f85081 into main Dec 27, 2022
@rgrinberg rgrinberg deleted the ps/rr/refactor_melange___move_stanza_definition branch December 27, 2022 14:11
jchavarri added a commit to jchavarri/dune that referenced this pull request Dec 29, 2022
* main: (148 commits)
  refactor(rpc): remove mutable callback (ocaml#6786)
  refactor(stdune): make [Id.t] immediate (ocaml#6795)
  refactor(melange): share mode handling (ocaml#6799)
  refactor(scheduler): remove duplicate types (ocaml#6785)
  refactor: move cram stanza definition (ocaml#6800)
  fix: correctly validate argument to top-module (ocaml#6796)
  refactor: move generate_sites_module to own module (ocaml#6798)
  fix(melange): check rules (ocaml#6789)
  refactor(rpc): make [Call.to_dyn] public (ocaml#6797)
  refactor(rpc): invalid session errors (ocaml#6787)
  refactor(melange): remove js globs (ocaml#6782)
  doc: fix version indication for "dune ocaml top-module" (ocaml#6792)
  refactor: print shutdown exception (ocaml#6784)
  refactor(rpc): add [Call.to_dyn] (ocaml#6790)
  fix: do not impose no_sandboxing on ocamldep (ocaml#6749)
  refactor(melange): move stanza definition (ocaml#6775)
  fix: handle missing CLICOLOR_FORCE correctly (ocaml#6781)
  Revert --display tui (ocaml#6780)
  fix: render pending messages
  refactor(coq): inline coqc_rule
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants