Gavin Ray
08/22/2021, 8:07 PMarrow-meta
called as-var-invariants
It seems to add some commits around pre
, post
and invariant
functions.
Is this going to enable a DSL for a sort of Design-by-Contract style programming similar to Ada and D, where you can state pre/post-conditions of a method and invariants of a method or class?
If so, very exciting!
• https://github.com/arrow-kt/arrow-meta/commit/38f6850bbeab3e2df7fffbd1409d0415c57a0006#diff-0cba0892a09ca12cf39e0816[…]8d75d7633e5d6fce55dd30fbfc15e
• https://github.com/arrow-kt/arrow-meta/commit/64efe5e7fed1c98dfd9460c79ec02f0eb6477708#diff-d8893c41325132d95cc89c5a[…]6dd9ea55a0c7fc4413d35bfb1d0ebraulraja
08/23/2021, 6:49 AMraulraja
08/23/2021, 6:53 AMrequire
and other known functions already that already denote pre conditions when in existing code bases.Gavin Ray
08/25/2021, 12:03 AMGavin Ray
08/25/2021, 12:04 AMGavin Ray
08/25/2021, 3:17 PM@Pre(formulae = ["(< (int x) 10)", "(> (int x) 0)"])
fun bar(x: Int): Int =
x + 2
val result = bar(30)
"""(
withPlugin = { failsWith { it.contains("fails to satisfy its pre-conditions") } },
withoutPlugin = { compiles }
Gavin Ray
08/25/2021, 3:20 PMraulraja
08/25/2021, 6:38 PMmattmoore
08/26/2021, 2:18 AM