Timeline for What are the advantages/disadvantages of distinguishing statements and expressions?
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 9, 2023 at 19:42 | vote | accept | Aman Grewal | ||
Jun 2, 2023 at 23:09 | history | edited | kaya3 | CC BY-SA 4.0 |
added 170 characters in body
|
Jun 2, 2023 at 23:00 | comment | added | kaya3 |
Yes, nullable types and optional types aren't the same, and also e.g. primitive int types generally can't be made nullable and have no niche for a sentinel None value in an undiscriminated union (like C's unions).
|
|
Jun 2, 2023 at 22:59 | comment | added | Bbrk24 |
Swift's optional is a tagged union, so Optional<Int16> is 3 bytes and Optional<Int64> is 9 bytes, for example.
|
|
Jun 2, 2023 at 22:58 | comment | added | Aman Grewal | I can't speak for other languages, but is there a difference between "optional types" and a language (like C) that supports both null pointers and union types? | |
Jun 2, 2023 at 22:54 | comment | added | kaya3 | @AmanGrewal All of the old-school imperative languages don't have option types in their standard libraries ─ C for example. Java didn't until 2014. | |
Jun 2, 2023 at 22:51 | comment | added | Aman Grewal | That's interesting, I certainly would not have thought about how this affects the type system. Do you have an example of a language that doesn't have an option type? | |
Jun 2, 2023 at 22:46 | history | answered | kaya3 | CC BY-SA 4.0 |