3 ms·
Go 1.18 added generics to the language. This allows you to have your types take types as parameters so that you can create composite types (types out of types).
by nx7487 5y ago
Go 1.18 added generics to the language. This allows you to have your types take types as parameters so that you can create composite types (types out of types). This lets you get a lot of expressivity and clarity about how you use Go.
Aren't structs already composite types?
- Koiwai 5y agoI guess the author meant "types of types".
- honkycat 5y agoShe? They? the website is called christine.website so it is probably not a man
- Koiwai 5y ago
- honkycat 5y ago
- Koiwai 5y agoI don't normally care about the author's gender, but I'd argue assuming that is a man is a honest mistake, as long as women in the tech industry is still a minority. Do you really need to go that far? I think that shows how fragile you're.
- honkycat 5y agowhen i make a mistake, i apologize and correct it. Especially one as minor as misgendering, which inevitably happens and is easily fixed with a quick: "oh, they*! My apologies!" so your assertion "i don't care" comes off as flippant and aggressive.
- xena 5y agoI'd prefer http://pronoun.is/xe/xer/xer/xers/xerself http://pronoun.is/xe/xer/xer/xers/xerself but they/them works too
- honkycat 5y agoi see! my apologies, i did look, and I made it as far as your twitter and still didn't parse that. Please forgive my ignorance! :)
- deleted 5y ago[deleted]
- brundolf 5y agoI assume the difference is that without generics you can't freely re-compose a struct type again with different, other types. You have to make a whole new struct type from scratch
- cttet 5y agoThe core difference is that structs are static. Once a struct is defined the type are fixed. "composite types" here refers to type that can be dynamically changed when you annotate them. i.e. if you have an custom array type, you can compose them on the fly with MyArray[int] or MyArray[MyCat], structs can't do that.