3 ms·
Swift's is true strong [Edit: I should have said "static"] typing. The compiler enforces it but saves you from having to explicitly specify it in unambiguous ca
by glhaynes 11y ago
Swift's is true strong [Edit: I should have said "static"] typing. The compiler enforces it but saves you from having to explicitly specify it in unambiguous cases. So:
let x: Int = 3
let y: Int = x
and
let x = 3
let y = x
are identical; in both cases, x and y are both strongly-typed as Int.
- halosghost 11y agoYou are confusing static typing and strong typing. I understand that both Go and Swift are statically typed. My comment is about saying that Go and Swift have type systems which are really strong, but such an assertion means nothing unless you give a point of reference (i.e., “strong compared to X”) To clarify, type inference and strength (or strictness actually) of typing are completely unrelated. For example, Haskell, which is statically typed (and far stronger than most other languages out there—though certainly not the strongest) has incredibly good type-inference, so you rarely need to specify types.