3 ms·
This is still strong typing, even it it's not static typing. It's static vs. dynamic and strong vs. weak. https://stackoverflow.com/a/11889763 https://stackov
by ncruces 2y ago
This is still strong typing, even it it's not static typing.
It's static vs. dynamic and strong vs. weak.
https://stackoverflow.com/a/11889763 https://stackoverflow.com/a/11889763
- 9rx 2y agoIt is strong, static, and structural. But structural typing is effectively compile-time duck typing, so it is understandable that some might confuse it with dynamic typing.
- masklinn 2y agoGgp is not talking about structural typing, but about sync.Pool type erasing (it takes `any` values, and returns `any` values). So you can put (and will retrieve) random garbage from it.
- 9rx 2y ago> Ggp is not talking about structural typing, Okay... but the reply was to the parent who questioned if the typing is static. It is by way of structural typing. The compiler enforces that the ducks, so to speak, are compatible. But as an empty interface has no constraints, all types are compatible. Whatever some other comment was talking about is irrelevant. > but about sync.Pool type erasing The type isn't erased...? p := sync.Pool{New: func() interface{} { return 1 }} fmt.Printf("%T", p.Get()) // Prints: int > So you can put (and will retrieve) random garbage from it. And you think that makes it dynamically typed? It does not.