Timeline for Why would a language allow zero-size structs?
Current License: CC BY-SA 4.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 3, 2023 at 1:17 | comment | added | Bbrk24 | In Swift, tuples and structs are actually quite different (and actually, I do mention empty types in that post). | |
| Jul 2, 2023 at 22:29 | history | edited | bigyihsuan | CC BY-SA 4.0 | added 31 characters in body |
| Jul 2, 2023 at 18:45 | comment | added | hobbs | @Bbrk24 sure, but Go doesn't have a tuple type, and in any case tuples are just a degenerate case of structs where the elements can't have meaningful names. If there are no elements, that distinction vanishes, so an empty tuple and an empty struct are really the same thing :) | |
| Jul 1, 2023 at 4:35 | comment | added | Bbrk24 | The idiom for that, in languages like Rust, is to use an empty tuple rather than an empty struct. | |
| Jul 1, 2023 at 4:21 | history | answered | bigyihsuan | CC BY-SA 4.0 |