3 ms·
> You require a pretty strong type system to make static lifetime management work Go is strongly and statically typed.
by IceWreck 5y ago
> You require a pretty strong type system to make static lifetime management work
Go is strongly and statically typed.
- Yoric 5y agoIt's a spectrum. Rust is further than Go in the direction of "strong type system", and somewhat lateral wrt Haskell, F# or OCaml, for instance (each is more strongly typed in different directions). Idris or Coq are further than Rust in most directions, etc.
- lucian1900 5y agoFor some value of "strongly". It has nil and lacks sum types, so it is comparatively much weaker than even Rust/Swift.
- masklinn 5y agoGo's type system is much, much weaker than what is needed for safe static lifetime management be even remotely close to workable. Static typing is not an on-off, there are statically typed languages with extremely weak type systems (e.g. C), languages with somewhat weak type systems (e.g. Java, Go), languages with strong type systems (e.g. OCaml, Haskell) and languages with extremely strong type systems (e.g. ATS, Idris). And that's a simplification because it's not linear either.
- remexre 5y agoRust's lifetimes need full subtyping, with covariant and contravariant type constructors (though I don't think it supports annotations for them, and always infers them instead), which I think would make the generics implementation quite a bit more complicated than it currently is...
- Yoric 5y agoYeah, the fact that co/contravariant type constructors aren't (or aren't always?) annotated has always felt a bit awkward to me. Ah, well, it works :)