3 ms·
No, it's really not equivalent to cracks about Turing completeness. Doing "dynamic" typing in a static language requires me to add all of 5 characters, e.g. ":
by kod 9y ago
No, it's really not equivalent to cracks about Turing completeness.
Doing "dynamic" typing in a static language requires me to add all of 5 characters, e.g. ": Any"
Doing static typing in a dynamic language requires me to write a type checker.
These are nowhere near the same.
- brandonbloom 9y agoClojure has type hints, I can add ^int to a symbol and get some “static typing”. That is: shitty static typing. However, this is about the same as the average Any type in a static language. In order to implement a good Dynamic type, you’d need to implement reflection, caching dynamic dispatch, etc. Haskell’s Typeable is an OK implementation, but not nearly as good as say the JVM’s or JavaScript, despite their many flaws.
- bad_user 9y agoBeing able to work with "Any" implies either working with Strings (since you can encode anything in strings) or it implies a memory unsafe language (e.g. working with void* in C) or it implies subtyping and hence an OOP language. But OOP subtyping is already about solving polymorphic call sites at runtime. And because you carry a vtable around for every instance, thus objects being tagged with their classes, you can always do upcastings and downcastings. So OOP languages are already very dynamic on that scale and fairly unsafe. No, you cannot do ": Any" in Haskell.
- tome 9y ago> No, you cannot do ": Any" in Haskell. https://hackage.haskell.org/package/base-4.10.0.0/docs/Data-Dynamic.html https://hackage.haskell.org/package/base-4.10.0.0/docs/Data-...
- tome 9y agoOn second thoughts I think kod used Any to mean something like Dynamic and bad_user assumed Any meant a top type, something like I believe Scala has.