Task { ... } macro is a beautiful lie
#6027
Replies: 1 comment
-
|
TBH, it's not clear to me what you are asking. Since tasks may be cached, it is inherent that the result may be produced in the past. Task inputs (= dependencies) are the way to capture dependencies instead of assuming that side-effects might produce inputs. Not relying on side-effects, but using return values (= (cached) task results) is the way to make the dependency graph robust and reasonable. When writing Edit: I also think the issue title, while catchy, isn't correct. There are no lies involved. When you write |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This one is more philosophical, but I've stumbled on this multiple times:
You write code like this, it looks beautiful, but instead of
you get:
And that can be very subtle to catch.
Under the hood the macro just transforms it to
(taskDep1, taskDep2).mapN { (dep1, dep2) => ... }, but the macro hides this transformation and I'm not sure that's a good thing.Pros:
ifstatements feels more naturalCons:
ifstatements are a partial lie - they only conditional the results of the tasks, but the tasks always runThoughts?
Beta Was this translation helpful? Give feedback.
All reactions