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

    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?


I 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


The 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.


I guess the author meant "types of types".


She? They?

the website is called christine.website so it is probably not a man


I'd prefer http://pronoun.is/xe/xer/xer/xers/xerself but they/them works too


i 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! :)


[flagged]


[flagged]


I 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.


when 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.




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

Search: