[some description]
https://gist.github.com/kkuriboh/b5c610742d3bab377d3387348d7b7261
#option monad for zig
1 messages · Page 1 of 1 (latest)
no fucking way
i always though those were used for nulls
ah, it still is kinda
i still like more the Option monad
it bloats your code by a good amount when using it for pointers
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
huh, xor for options does make make sense formally. now, what is some good usecase..
yes, it's just a helper function if you wanna chain it
i didnt know about half of this api
that's what i assumed