4 ms·
> For example, "Structural, Open-by-Default Typing". It sounds really interesting, but the image next to it just looks like what you'd get in Go (except for nul
by sbergot 7y ago
> For example, "Structural, Open-by-Default Typing". It sounds really interesting, but the image next to it just looks like what you'd get in Go (except for nullability checks), C#, Kotlin, and many other languages.
Go types are structural. C# types are nominal.
https://en.wikipedia.org/wiki/Structural_type_system https://en.wikipedia.org/wiki/Structural_type_system
"Open-by-Default" probably refers to the fact that structural types are more flexible to use.
- Arnavion 7y ago>Go types are structural. C# types are nominal. Go's type system is also nominal. If it were structural, it would allow you to have two types `type foo struct { id string }` and `type bar struct { id string }`, and let you assign a value of type `foo` to a binding of type `bar`, which it does not.