Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
_flux
17 hours ago
|
parent
|
context
|
favorite
| on:
Odin: Moving Towards a New "core:OS"
What language is this? I'd expect a language with a ? -type would not use an Optional type at all.
In languages such as OCaml, Haskell and Rust this of course works as you say.
_rend
17 hours ago
[–]
This is Swift, where Type? is syntax sugar for Optional<Type>. Swift's Optional is a standard sum type, with a lot of syntax sugar and compiler niceties to make common cases easier and nicer to work with.
reply
_flux
17 hours ago
|
parent
[–]
Right, so it's not like a union type Type | Null. Then naturally it works the same way as in the languages I listed.
reply
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
In languages such as OCaml, Haskell and Rust this of course works as you say.