News for hackers. Stuff that matters.
Re:TypeScript for Pythonistas by wk_end on Friday December 17, 2021 @04:42PM (#29598694)
Structural typing is enforced at compile time, duck typing is "enforced" at runtime (by going up in a burst of smoke if you provide something that doesn't quack like a duck).
Re:TypeScript for Pythonistas by ninkendo on Friday December 17, 2021 @04:47PM (#29598749)
Duck typing can still be a compile-time thing… C++ templates are “duck typed” in that the template can’t specify the bounds for the passed-in type, but if you pass the wrong type, it still breaks at compile time instead of runtime. (It’s just that the error messages are way more impenetrable than they otherwise could be.)
Re:TypeScript for Pythonistas by wk_end on Friday December 17, 2021 @04:57PM (#29598853)
I’d argue that either “runtime is compile time in the case of C++ templates” and/or “C++ templates are structurally typed”, especially now that concepts are a thing.

ETA: and/or that talking about C++ templates as "typed" one way or another is problematic, given that they're a part of the type system.