4 ms·
Go’s structural interfaces are one of the worst features of the language, partially due to the implementation and partially due to the fact that structural typi
by sidlls 4y ago
Go’s structural interfaces are one of the worst features of the language, partially due to the implementation and partially due to the fact that structural typing like in Go is just a terrible idea in a statically typed language. May as well just use a dynamically typed language: because that’s what go’s duck typing leads a code base to be in practice anyway
- foota 4y agoDoesn't this also lead to a light implementation of monomorphization though?
- pcwalton 4y agoStructural vs. nominal typing has nothing to do with monomorphization. Depending on what you consider "structural typing" and how much you care about separate compilation, it may prevent you from doing monomorphization in some cases (e.g. OCaml's polymorphic variants require indirection at runtime). This doesn't apply to anything in Go or Rust, though.
- foota 4y agoYes... I guess this is the case. I was thinking that the GC shapes used in Go monomorphization were related to the structural typing, but thinking about it more, this isn't really the case.
- deleted 4y ago[deleted]
- hajile 4y agoStructural typing works very well in StandardML (and in Ocaml these days too). It's not structural typing, but how you use it. One of the biggest benefits of structural typing is how you can have most of the ergonomics of untyped languages while actually getting the performance and safety of sound typing.