3 ms·
Dynamically typed languages can have strong type systems, ~~eg Haskell, some parts of Rust can be inferred.~~ In C static types exist, but type coercion means
by PartiallyTyped 4y ago
Dynamically typed languages can have strong type systems, ~~eg Haskell, some parts of Rust can be inferred.~~
In C static types exist, but type coercion means you can shoot yourself in the foot if you wish to.
What I meant above is not that Haskell and Rust are dynamically typed. That’s an error on my side but that the types are inferred. Left for posterity.
- CuriousCosmic 4y ago> Dynamically typed languages can have strong type systems, eg Haskell, some parts of Rust can be inferred. To be strictly accurate, Rust and Haskell both have strict type systems. It's just that like you mentioned, the types are often inferred at compile time via type inference rules. This differs from dynamically typed languages as inferred types always have a statically known type while dynamic types have a type which is interpreted at runtime and which can be reinterpreted.
- kqr 4y agoHaskell has a static type system. "Strictness" in PL theory usually refers to an eager evaluation strategy. But yes, you are correct. The comment you replied to does not make sense. Haskell is not dynamically typed at all. (Though as with any statically typed language, you can create a Grand Unified Type that stores everything and pretend it's dynamic.)
- ekleraki 4y agoYou are correct my comment did not make sense. What I meant was that types may be inferred but that is not the same as dynamic typing.
- marcosdumay 4y ago"Strictness" when applied to types usually refers to the existence of implicit type conversions. Overall, "strictness" is a really bad word to use, because it has thousands of different meanings. But on the context of types, I don't know of any better synonym.
- CuriousCosmic 4y ago> Haskell has a static type system. "Strictness" in PL theory usually refers to an eager evaluation strategy. Ah yep. Meant static there and fumbled my words. That's what I get for browsing HN first thing in the morning before coffee.
- hsn915 4y agoThe point (when you take my comment in context) is that it doesn't matter if your editor does not detect typos, because the compiler will. Now, I admit, I find programming with autocomplete more productive in general, but the compiler (and the compile time type checking mechanism) is still indispensible.
- jameshart 4y agoBut using a basic text editor without even syntax highlighting, together with a separate compiler, extends your feedback loop on typos and syntax errors and - in strong type systems - logic errors your type system can catch. Sure, I don’t have to run the program to find the fault - but I have to run the compiler. And then parse its output and find the line it’s telling me about. In an IDE, such feedback can be immediate, in place, and point me to the symbol where the error is evident.
- hsn915 4y agoOn the other hand, autocomplete interferes with your thought process and makes you used to not having "long" programming thoughts: you can only think one word at a time. I'm personally not there yet, but the way I've seen advanced programs write code is more akin to writing whole paragraphs at once and then relying on the compiler to catch any typos or similar trivial mistakes.