I'm curious why this syntax was adopted: `return z...
# arrow
m
I'm curious why this syntax was adopted:
return z.post({ it > 0 }) { "greater than 0" }
where the string is in a block, rather than a parameter. It seems less visually noisy to write as
z.post("greater than zero") { it > 0 }
- yeah it's different to require, but it seems to make more sense
đź‘€ 1
a
this is mostly to follow the syntax for Kotlin’s own
require
blocks
s
the main benefit is that the lambda is lazily evaluated, so no allocation happens unless the condition is broken
m
That's true for require but isn't true here, right? I thought pre/post are just hints to the SMT solver, they don't actually get compiled into the production code?
The string has to be a constant anyway?
a
currently it does if you want it to be considered by Arrow Analysis
indeed having the string inside
{ }
is not needed for Analysis, but we still decided to do so for consistency