-
-
Notifications
You must be signed in to change notification settings - Fork 359
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
[RFC] Rename T{...}
and T[_]
to task{...}
and Task[_]
, standardize "Task"/"Target" terminology around "Task"
#3338
Comments
T{...}
and T[_]
to task{...}
and Task[_]
?T{...}
and T[_]
to task{...}
and Task[_]
, standardize "Task"/"Target" terminology around "Task"
T{...}
and T[_]
to task{...}
and Task[_]
, standardize "Task"/"Target" terminology around "Task"T{...}
and T[_]
to task{...}
and Task[_]
, standardize "Task"/"Target" terminology around "Task"
There is a high change to produce collisions hard to resolve in older external code bases or projects. E.g.
is ambiguous, since today we already have a I'm also not so sure whether |
I would tend to just leave it alone. |
That's a good point. And since Personally, I'd like to not deprecate the short |
I'd like to push on this just a bit more: It's not just that one random guy on r/java, folks on r/scala have called Mill alien and cryptic as well. Obviously as maintainers we do not feel the same since we are 100% comfortable with living and breathing Mill, and some amount of unfamiliarity is to be expected from outsiders. But I'd like to take this as an opportunity to consider if we can do better. What is cryptic or alien about Mill code for Scala developers? Although Mill looks mostly like normal Scala code - method calls, blocks, inheritance, etc. - I can list a few things:
Other than these things listed above, Mill code looks exactly like vanilla Scala code: function calls taking blocks This whole As of now, I don't think I have a full solution to propose here yet. But I'd like to discuss this and see if this can go anywhere. |
I agree, that mentally I also see all those Mill projects and plugins in the wild and really fear a rough migration path paired with frustration. Since we run the normal Scala compiler, pure compiler error messages is what our users face once they hit a changed API. We need to make that experience smooth. I've seen abandoned older Mill plugin projects on GitHub and trying to get them to work in newer Mill versions was rather frustrating, even for me how really knows the Mill API. Once you have an old Improving for new users is great, but we should not leave existing users behind. |
What always bugged me is the fact that a So, wouldn't it make sense to move some types like def worker: Task.Worker[Work] = Task.Worker { .. }
def persistent: Task[String] = Task { .. }
def anon: Task.Amon[String] = Task.Anon { .. } We could also make it lower case, but it would be alien to have lower-case class names, wouldn't it? def worker: Task.worker[Work] = Task.worker { .. }
def persistent: Task[String] = Task { .. }
def anon: Task.amon[String] = Task.anon { .. } And if we move the factories into the respective companion object def cmd(): Task.Command[String] = Task.Command { .. }
def cmd(): Command[String] = Command { .. }
def cmd(): Task.Command[String] = Command { .. }
def cmd(): Command[String] = Task.Command { .. } |
For migration, there are things we can do since this is such a core API. e.g.
Migration is definitely a concern, especially for such core APIs, but I think we can do something reasonable to address it as long as we are careful |
I have also thought about making Some of the weirdness around |
The existing So here is my question. Can we simplify it's design or make it more principled? Since it's at its core two components, an anonymous task and a CLI module wrapping it, maybe we should make it either two |
Took another pass at this at #3356. I think I'm pretty happy with the result. It does make some tradeoffs, but I think the approach taken is solid and the improvement in user experience is worth it. For
I think (2) could work and be a pretty seamless experience. Worth exploring |
Calling this done; half done in 0.12.0 standardizing on |
T{...}
andT[_]
syntaxes are kind of weird. They are concise, but I don't think the conciseness they bring pays for the weirdness. And the weirdness does get noticed, e.g. recently on Reddit. I notice it too. Part of the reason it's there is thatTarget[_]
andTarget{...}
is too verbose, but maybe that's fixableThis proposal would be to leave the
T
aliases in place but deprecated, add a newtask
alias for the expressions:T{...}
->task{...}
T.command{...}
->task.command{...}
T.task{...}
->task.anon{...}
T.dest
->task.dest
, ...)T[_]
->Task[_]
Task[_]
andtask{...}
are maybe short enough (compared toTarget
) that we can do without theT
aliasThis would make the codebase a lot more approachable for folks not used to weird Scala DSLs
There's some messiness around how the
Task
/Target
hierarchy is arranged right now that may require a breaking change to make this work well.e.g.Target
may need to becomeTask
, if we want to use theTask
terminology everywhere instead ofT
. But thenTask
would need to be renamed to avoid confusion (BaseTask
?). This would basically be cleaning up some of the messiness that we failed to totally resolve earlier in #2402, as the status quo today the terminology of whether we should call things tasks or targets is still a bit muddled.e.g. we may need to go from today's:
Task
Task.Sequence
,Task.TraverseCtx
,Task.Mapped
,Task.Zipped
,T.task
, etc.NamedTask
Command
Worker
Target
TargetImpl
PersistentImpl
InputImpl
SourceImpl
SourcesImpl
To something like
BaseTask
Task.Sequence
,Task.TraverseCtx
,Task.Mapped
,Task.Zipped
,T.task
, etc.NamedBaseTask
Command
Worker
Task
TargetImpl
PersistentImpl
InputImpl
SourceImpl
SourcesImpl
That would allow us to consistently use the term
Task
everywhere, withBaseTask
andNamedBaseTask
being niche interfaces that are mostly interesting only for advanced users.The text was updated successfully, but these errors were encountered: