Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In Swift, String? is an alias to Optional<String>. Optional is an enumeration with two cases: some, and none, where the former has the non-nil value attached. I‘m not sure how that ties in with subtyping though.


> how that ties in with subtyping

In Swift it does not. But in Kotlin, `String?` is not an enum (sum type), but instead means `String | null`, a union type.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: