@andnull@social.nouveau.community
Post #4147614
2026-07-27 21:23 UTC
Heart breaking: creature discovers OCaml cannot do the DSL trick as well as Lua. when_ returns a record with otherwise as a field. However, you have to wrap the call with parens cause OCaml's syntax doesn't allow f "foo" .bar "baz" (it has to be (f "foo") .bar "baz" as far as we can tell)
let cond =
(when_ coin [
say "Hello, World!" ;
say "Coin was heads!"
]) .otherwise [
say "Hello, World!" ;
say "Coin was tails!"
]
Replies (1)
-
@atax1a@infosec.exchange 2026-07-27 21:26
@andnull@social.nouveau.community try when_ @@ coin [ without the parens