4 ms·
The article missed Go’s anonymous structs: p := struct { Name string Age int }{ Name: "Alice", Age: 30, }
by antonvs 4mo ago
The article missed Go’s anonymous structs:
p := struct {
Name string
Age int
}{
Name: "Alice",
Age: 30,
}
- Timwi 4mo agoTechnically anonymous I suppose because the struct is not named, but the article is mostly about type inference while your example has every type made explicit.
- antonvs 4mo agoThe article mentions Typescript and Purescript under the heading "Static typing" - their definitions correspond exactly to the Go definition, with explicit types for the members. I was just saying that for completeness, Go should probably be mentioned in that list since it's become a pretty significant language. (For the record, I'm an absolute Go hater, but I'm also a PL enthusiast, so...)
- Gabriel439 4mo agoAuthor here: those type annotations are optional in the case of TypeScript and PureScript; I only included the type annotations for clarity That said, I didn't know about Go's support for inline struct definitions like that!