enum Option<T> {
None,
Some(T),
} fn Maybe(comptime T: type) type {
return union(enum) {
value: T,
nothing,
const Self = @This();
pub fn just(the_val: T) Self { return .{ .value = the_val }; }
pub fn nothing() Self { return .nothing; }
}
}
Over this? data Maybe a = Just a | Nothing
I also think it signals that I was happy with that solution in the ongoing conversation.
On the other hand, I'm much more sloppy with my writing.
The token cost is irrelevant, tool calls and reasoning probably dominates.