I've just published the first-ever release of <Wit...
# feed
y
I've just published the first-ever release of Wither! It's a compiler plugin that reduces nested
with
calls by allowing you to write code like:
Copy code
with("Hello world")
contextOf<String>()
Features: •
with
can contain multiple values
with("Hi", 42)
, with semantics similar to context parameter groups (but note that, currently, the values are introduced as extension receivers, so it's truly like
with
instead of
context
) • multiple `with`s can override each other:
Copy code
with("Hi")
with("Low")
println(contextOf<String>()) // prints "Low"
• `with`s are scoped inside of the local block, and so you can have
with
calls inside an
if
or a
when
branch, and it won't affect other call sites. This means you can also have them in lambdas! Under the hood, this uses the same infrastructure that DataFrame uses. Hence, I'm somewhat confident that this plugin will continue to be possible. Try it today!
Copy code
plugins {
  id("io.github.kyay10.wither") version "0.0.1"
}
and simply import
io.github.kyay10.wither.with
K 7
👀 11