I've come to the conclusion that the benefit dynamic typing brings to the table is to allow more technical debt. Now of course technical debt should be repaid at an appropriate moment but that appropriate moment isn't always "as soon as possible". Let me illustrate, say you're adding a new feature and create lots of bugs in the process. Static typing will force you to fix some of these bugs before you can test out th…
It’s true that with static typing, you are usually forced to propagate your changes to “your whole codebase” to get it compiling before you can run any of it. That stinks. However, it turns out you can lift this restriction in static languages, and this is what Unison does: https://www.unisonweb.org/docs/refactoring In Unison you can implement a change and propagate it just far enough to run one little experiment. Th…
Dynamic type systems are not inherently more open
101–110 of 286 posts
Re: Dynamic type systems are not inherently more open
#102Earlier quoted context omitted.
Not all untyped languages are the same. E.g. Clojure now encourages specifying assumptions with spec annotations, some of them are stronger than those that can be expressed by Haskell's type system: i.e. they can succinctly express more about the "entire code" than Haskell's types. Types are not the only way to write formal assertions and assumptions about code. The difference between the two is in the level of sound…
Also, the following part isn't necessarily because of dynamic typing vs static > what types all the variables are, what expectations are attached to them, what mutation, if any, each method call performs But more about what the language offers. Clojure for example, goes beyond types with it's abstractions (like seq, that can be applied to strings, lists, maps and so on) and normally stays away from mutation, but when…
Re: Dynamic type systems are not inherently more open
#103Earlier quoted context omitted.
On what editor setup you get this kind of functionality with Haskell? I mean the auto-insert of the inferred types.
I’ve been out of the game for a number of years but I used something called ghc-mod [1] with its associated vim plugin [2] to get this functionality. Moving forward, it seems that all of the effort has moved over to Haskell IDE Engine [3]. It looks like this exact feature hasn’t been brought over yet but it is planned. In the mean time you could still use ghc-mod though. [1] https://github.com/DanielG/ghc-mod [2] htt…
Ghcide is on my list to try next as it's gotten a lot of attention lately.
Re: Dynamic type systems are not inherently more open
#104Earlier quoted context omitted.
On what editor setup you get this kind of functionality with Haskell? I mean the auto-insert of the inferred types.
It seems that "ghcide" can do this: https://twitter.com/chris__martin/status/1218331415869190144 https://github.com/digital-asset/ghcide
Re: Dynamic type systems are not inherently more open
#105Ruby is also moving in the same direction, as far as I know.
Re: Dynamic type systems are not inherently more open
#106The author doesn’t really address the issue raised in the first (longer) quoted post. Given a set of reasonable requirements I think pretty much no one would claim a general-purpose language couldn’t satisfy them without too much trouble. In fact, that might be a fair definition of a general-purpose language. I’m fine with strong and expressive static type-checking, but you need to hold the main limitation in mind as…
Re: Dynamic type systems are not inherently more open
#107Earlier quoted context omitted.
But I believe this is also with the spirit of the article. Your functions still assume something about input and are polymorphic over everything else in it. AFAIK this can also be done in a type safe manner in languages which support extensible records/row polymorphism.
You don't need row polymorphism to write a function which operates on a collection of key/value pairs and expects a specific key to exist at runtime. This works in Haskell, just as it does in Clojure.
Re: Dynamic type systems are not inherently more open
#108Earlier quoted context omitted.
Yes. Perhaps this is an indication that we actually need automated type annotation. E.g. you initially write/prototype your program in a dynamically typed form, then you click a "magic" button, and a tool converts your program into statically typed style.
This already exists in Haskell. Firstly, Haskell has type inference so you can write entire programs without any type annotations. Second of all, since type annotations actually help to document your code, it’s recommended as good Haskell style to annotate all top-level definitions. To aid you in the latter task, you can press a key in your editor to fetch an automatically-inferred type for the name under the cursor…
Re: Dynamic type systems are not inherently more open
#109But flow/ts is major step towards practical solution, it covers something like 65% of properly typed language (properly = algebra on types, structural+nominal typing, opaque types, nullability exposed at type level, aggressive inferrence etc.)
Re: Dynamic type systems are not inherently more open
#110Earlier quoted context omitted.
Not all untyped languages are the same. E.g. Clojure now encourages specifying assumptions with spec annotations, some of them are stronger than those that can be expressed by Haskell's type system: i.e. they can succinctly express more about the "entire code" than Haskell's types. Types are not the only way to write formal assertions and assumptions about code. The difference between the two is in the level of sound…
Also, the following part isn't necessarily because of dynamic typing vs static > what types all the variables are, what expectations are attached to them, what mutation, if any, each method call performs But more about what the language offers. Clojure for example, goes beyond types with it's abstractions (like seq, that can be applied to strings, lists, maps and so on) and normally stays away from mutation, but when…
Goes beyond types? Statically-typed languages can have polymorphism.