<https://kotlinlang.slack.com/archives/C8UK6RTHU/p...
# arrow
d
Is the new optics gradle plugin documented somewhere (new features/caveats...)?
a
Not yet. In short, it’s just a Gradle plugin that at the same time applies the KSP one and adds companion objects if needed (so you don’t have to do it manually)
👍🏼 1
r
…and the new Racing DSL? Any documentation?
a
the docs are not written yet since the API is still (slightly) in flux
🫠 1
r
Any pointer to the code?
a
r
Muchas gracias
kodee welcoming 1
a
r
So, if the fastest computation fails, you still expect the second one to see if it succeeds and return its value?
Did I get it right?
a
you actually decide per-computation. If you use
race
, that means you only "take it" if the cimputation succeeds, but you also have
raiseOrFail
, which is purely decided on the fastest
🙏 1
r
The default behavior on asynchronous libraries like Cats Effect or Zio in Scala is to return the first result, whether it's a failure or a success
a
in this DSL you can mix and match
Copy code
racing {
  raceOrFail { /* allow for exception or raise as result */ }
  race { /* only if successful (no exception or raise) */ }
  race(condition) { /* as bove + condition must be true */ }
}
so one computation may be OK to fail, but others not
r
They also offer the possibility to return the first successful result
Here, the semantics seem richer
What if somebody put some code inside the
racing
block that doesn't belong to any
race
task?
a
that's fine, you can consider it the "configuration" phase of the racing. But the result of the racing block is always coming from the race tasks
arrow intensifies 1
K 1
r
I like the syntax. It's very close to the Accumulation DSL 👏
🤩 1