#option monad for zig

1 messages · Page 1 of 1 (latest)

shut wadi
frigid lark
shut wadi
#

no fucking way

#

i always though those were used for nulls

#

ah, it still is kinda

#

i still like more the Option monad

warm bane
#

also did you know that your none() function is not necessary?

var x: Option(u32) = .None;
#

.unwrap() is .? on zig options
.unwrap_or() and .unwrap_or_else() are both orelse
is_some can be written as opt == .Some, same for is_none()
also is done by opt != null with zig optionals

dry fractal
#

huh, xor for options does make make sense formally. now, what is some good usecase..

shut wadi
shut wadi
warm bane