Skip to content

add stdout as output from dream_eml#228

Merged
aantron merged 1 commit intocamlworks:masterfrom
tcoopman:dream_eml_stdout
Jun 5, 2023
Merged

add stdout as output from dream_eml#228
aantron merged 1 commit intocamlworks:masterfrom
tcoopman:dream_eml_stdout

Conversation

@tcoopman
Copy link
Copy Markdown
Contributor

quick and dirty implementation for #227

this should work with this dialect in dune-project

(dialect
 (name eml)
 (implementation
  (extension eml)
  (preprocess (run ./main.exe --stdout %{input-file})))
 (interface
  (extension emli)
  (format (run cat)))
 )

I only tested this very briefly but it seems to work fine. I think the interface stanza is required, but that will never been needed I guess?

If this is something that is worth doing, let me know and then I can maybe look into rewriting some examples as well to use the dialect?

@gpetiot
Copy link
Copy Markdown

gpetiot commented May 17, 2023

This would be very useful for ocaml.org! (ocaml/ocaml.org#1181)

@aantron
Copy link
Copy Markdown
Collaborator

aantron commented May 22, 2023

Note to self for searchability: (dialect) requires Dune 1.11, which probably doesn't require telling the users about because Dream already typically asks people to use newer Dune, and there are probably few users of such old versions anyway.

@aantron
Copy link
Copy Markdown
Collaborator

aantron commented May 22, 2023

Thank you! This is a huge improvement, and I will merge this.

We need a few things from Dune to make this fully ergonomic:

  1. Drop the requirement for a dummy (interface). Since we are going to recommend these stanzas to users, it's best for them to be brief and to have nothing unnecessary.
  2. Support for files with multiple extensions, since we are currently recommending .eml.ml files. Long-term, if there is syntax support, we might switch to .eml files, but it might be possible for Dune to support files with multiple extensions.

@aantron
Copy link
Copy Markdown
Collaborator

aantron commented May 22, 2023

@tmattio, @gpetiot, @emillon, I've opened two issues on Dune (ocaml/dune#7776, ocaml/dune#7777) about improving the ergonomics, and I think I will merge this regardless. I might tweak the command line before release, and deprecate the "old" instructions for integrating eml into projects. Very glad to learn about (dialect).

@aantron aantron merged commit 82f662e into camlworks:master Jun 5, 2023
@aantron
Copy link
Copy Markdown
Collaborator

aantron commented Jun 5, 2023

Thank you! I will update the docs to describe this in a follow-on commit.

aantron pushed a commit that referenced this pull request Jun 5, 2023
@aantron
Copy link
Copy Markdown
Collaborator

aantron commented Jun 5, 2023

Since Dream's examples recommend .eml.ml files, documenting this is blocked on ocaml/dune#7777 ("Support multiple extensions in (dialect) patterns") in Dune, which will probably come out in the next release. This is already usable from Dream master with single extensions, like .eml, as found in the Ocaml.org sources.

dysinger pushed a commit to dysinger/dream that referenced this pull request Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants