Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
oefrha
· 6y ago · 0 comments
Exclamation mark for optional is just weird. Question mark would be a lot more intuitive, unless there’s an origin story here I’m not aware of.
Comments
[–]
angry_cactus
6y ago
Not sure of the exact motivation, but Swift uses exclamation mark to unwrap optionals.
[–]
oefrha
OP
6y ago
In Swift optional types are marked by a question mark (exactly as I suggested). Unwrapping an optional makes it non-optional, so the exclamation point has the opposite meaning.
[–]
yusufnb
6y ago
Its updated now to work with ? syntax