Skip to content

refactor(melange): move stanza definition#6775

Merged
rgrinberg merged 1 commit intomainfrom
ps/rr/refactor_melange___move_stanza_definition
Dec 27, 2022
Merged

refactor(melange): move stanza definition#6775
rgrinberg merged 1 commit intomainfrom
ps/rr/refactor_melange___move_stanza_definition

Conversation

@rgrinberg
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

| 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
Copy Markdown
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
Copy Markdown
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.

@jchavarri jchavarri added the melange Melange rules and generator label Dec 27, 2022
@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

melange Melange rules and generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants