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

[env stanza] [feature request] More flexible behavior for wildcard pattern #1501

Open
ejgallego opened this issue Oct 25, 2018 · 4 comments
Open

Comments

@ejgallego
Copy link
Collaborator

In Coq's root Dune file we have:

(env
 (dev     (flags :standard -rectypes -w -9-27-50+40+60))
 (release (flags :standard -rectypes))

I'd be great if we could instead write:

(env
 (dev     (flags :standard -w -9-27-50+40+60))
 (_ (flags :standard -rectypes))

so the wildcard pattern is also applied to the profiles there.

c.f. #1155 (comment)

@ghost
Copy link

ghost commented Oct 31, 2018

Changing the meaning of _ would be a breaking change, however to keep the syntax light, we could simply introduce a special :common key:

(env
 (:common (flags :standard -rectypes))
 (dev     (flags :standard -w -9...)))

@ghost ghost mentioned this issue Oct 31, 2018
@rgrinberg
Copy link
Member

What about just introducing general bindings? We're pretty much going to have the mechanism for it with setenv, might as well reuse it. E.g:

(let
 (:common foo bar)
 (env
  (_ (flags %{common}))
  (dev (flags %{common} -w -9))))

@ghost
Copy link

ghost commented Nov 1, 2018

Why not. Its just quite a bit more work. For instance, if we want to correctly interpret things like this: (let (:x :default x y) ...), then we can't evaluate :default x y immediately as the expansion of :default depend on the context. On the other hand, %-forms should be expanded in the context of where the variable was bound. So we have to create a closure.

@ejgallego
Copy link
Collaborator Author

IMVHO this may be such a common issue / use case that it would make sense to get explicit support for :common, but of course YMMV.

let scares me a bit as it reminds me of make :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants