codex-storage / questionable

Elegant optional types for Nim
Other
116 stars 5 forks source link

[Feature] add `.!` #44

Closed hamidb80 closed 10 months ago

hamidb80 commented 1 year ago

like ! operator when you confident about the presence of the value:

let s = some "Hello"
echo s.!len
markspanbroek commented 1 year ago

Thanks for the suggestion @hamidb80! I'm not sure whether the .! would be useful for most cases. You can already use (!s).len, and chaining it like you would with .? (a.?b.?c) is not necessary, because you already remove the optional at the first step.