Replies: 2 comments 1 reply
-
Related:
|
Beta Was this translation helpful? Give feedback.
-
In theory the In practice that might not be true right now due to edge cases in the macros and type inference, but it should be possible to make it work |
Beta Was this translation helpful? Give feedback.
-
This is the attempt to persist an interesting conversation on Discord and continue it.
Here is the conversation:
@lefou wrote:
@lihaoyi wrote:
I'd like to add, that there are other issue with command, e.g. we don't have a nice compatibility story to evolve existing commands. As
Command
s need to be resolved via reflection and also support CLI options parsing, we can't rely on Scaladef
overloading. Hence, it's not easy to evolve a command that acceptsargs: String*
to a more type-safe API.But we are more free when it comes to
Task
s. We could easily add a new tasks accepting more arguments and just forward the command to that task with some mainargs magic applied.What, if we write all commands as tasks and then only add a small marker to the tasks that should be exposed as a command?
I envision some more binary compatible signature for commands, e.g.
Array[String]
like we have fordef main
.There are multiple ways to realize that.
T.command
could be just an alias toT.task
plus the generation of a synthetic command. Or some other way. I have not really thought it through, especially regarding what's possible with macros in Scala 2.13 vs Scala 3. Hence, I'd like to hear your comments and ideas! Hopefully, we can come up with an design overhault and a final pull request.Beta Was this translation helpful? Give feedback.
All reactions