I wonder how the value types in Swift (Int, Float...) are implemented to support optional binding (\"?\"). I assume those value types are not allocated on the heap, but on t
Optionals are implemented as shown below. To find this, CMD-Click on a declaration like var x: Optional. var x: Int? is just syntactic sugar for that.
enum Optional : LogicValue, Reflectable {
case None
case Some(T)
init()
init(_ some: T)
/// Allow use in a Boolean context.
func getLogicValue() -> Bool
/// Haskell's fmap, which was mis-named
func map(f: (T) -> U) -> U?
func getMirror() -> Mirror
}