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
Support grouping arguments to higher-order tasks #1138
Comments
Ahh, dangling commas. Just looking at How should the scope be defined though? Should aliases be kept lexical, or should they be dynamic? If implemented, this should also be provided from or done within leiningen-core, as every task with a Then again, using aliases ( |
Nesting aliases is a good concept, I agree. I didn't get your question about the scope of aliases. As for HOTs that do not chain, this is something I did take into account:
This will parse correctly into (thrush (uberjar) (upload))
(with-profile :dev (do (compile) (test)) I don't see this proposal as more complexity; the complexity is exactly the same, just more useful. |
So, what I wonder about is how e.g. (do (with-profile "+dev" "test")
(deploy "clojars")) But without proper handling, this may turn into something more messy. When I talked about dynamic vs lexical scoping, I was thinking of something like this: ;; part of project
{:aliases {"alias" ["foo" "bar," "baz"] ...} ...}
;; Running `lein do alias, test`
;; Lexical scoping:
(do (foo "bar," "baz")
(test))
;; Dynamic scoping:
(do (foo "bar") (baz) (test)) |
This is a fair point; the current semantics are better suited to the nesting of non-chaining HOTs and my proposal would shift that in favor of the chaining of chaining HOTs. I did experiment with additional meta for chaining tasks, but in the end thought it wouldn't be needed. This counterexample makes me doubt that conclusion.
This is about the order of application of alias expansion vs. argument grouping. My idea was to always start from what the user entered and let alias expansion happen late, within each HOT. So that would correspond to your "lexical scoping". However, there may be related complications when the alias resolves to a HOT and thus takes over the parsing of the rest of the command line: it may result in unintuitive behavior. |
I'm closing this for now because more investigation is needed to formulate a better proposal. |
@mtopolnik - I'll reopen it since it would most likely be forgotten if we don't have an open issue on it. I also have some ideas on how to handle this without getting it too dirty. |
I think this should be better supported, but there are a few questions we should address first.
|
|
After some thought, some meta will have to be used to distinguish tasks that employ the comma delimiter (not If this is not used then other mechanisms would need to be introduced, and it would be only getting more complex. As far as signalling the end of a task chain, consider this:
Notice the space before the last comma. |
More on the "escape the comma" approach:
|
Re-reading this discussion, it sounds just like an argument precedence issue. If we're going to support arbitrary nesting, it should probably be specified using matching delimiters. |
This whole issue would be a triviality if we didn't face the constraints of the command line. All the braces are taken and would need escaping. Maybe just live with escapes? |
Looking back at this, I don't think this complexity is justified given that this ambiguity does not exist in aliases, which are a better way to accomplish this. |
If I write the following;
do
will parse it intowhich will prevent me from combining
do
withthrush
. It would be more useful ifdo
realized thatthrush
is a higher-order task and turned everything over to it for further parsing:I have already implemented this in my lein-nix project and it works very well, for example, with this complex expression:
where
xdo
is mydo
with the changed semantics. The above is a complete deployment script laid out as a singlelein
invocation, which can be easily turned into an alias.Please consider applying the same semantics to leiningen's
do
.The text was updated successfully, but these errors were encountered: