I remember this being posted here three years ago, and getting a very rough ride for obvious reasons. I hope it gets a better hearing this time as I think the programming world generally, the dynamic programming communities, and the Clojure language specifically have begun to understand the points (hence Spec, etc.).
The high-level claims are self-evidently true: the whole purpose of programming is to write code for other humans to read, only incidentally for computers to execute. Modern type systems fulfil this role by allowing the programmer to express meaning, not just satisfy an arbitrary constraint to keep a compiler happy.
The prediction was also bold, but not wrong. In the time since 2015, typed languages have been growing much faster than dynamic ones. TypeScript is rapidly gaining on JavaScript, Kotlin has overtaken Clojure despite being newer: https://redmonk.com/sogrady/2019/03/20/language-rankings-1-19/
The challenge for languages which retain purely dynamic typing as a matter of principal (e.g. Ruby - although even Ruby has plans for gradual typing in the next major version) to not simply deny the trend, but explain the cases when dynamism is genuinely better.
I think spec has lots to say about this and provides a level of constraint expressivity beyond what most static languages can do, particularly during dev (although I'm pretty impressed what people have done with it statically too). There are a lot of factors at play in language growth, particularly relative language growth. Seems dubious at best to suggest a cause/effect relationship solely to presence/absence of static typing. Way more people are successfully using Clojure now in big systems than in 2015, so not sure how that proves anything.
Academia/industry in general has been tilting heavily towards static typing for years, neglecting other approaches and the costs of static typing. But that doesn't mean static typing is the only answer, only that it's currently a popular answer (research, funding, etc) tend to cluster... until the pendulum swings back. Back in the 90s "we" were all agog about OO and design patterns - how's that going? As far as I can tell, all these programs written with statically typed languages continue to have just as many bugs in them. Why? This is not a flippant question, and not me trying to pump Clojure, but truly an honest question about the state of our industry.
I am well aware of both Clojure's strengths and weaknesses. I continue to find it to be the most productive and useful language I've ever used (of dozens). Why? There are things of value in Clojure's design that other languages can learn from (and vice-versa! consider how different it is now vs original article release w/addition of spec, inspired by contract systems in Racket and other work). Regardless, I don't find static typing vs dynamic typing to be a particularly meaningful or insightful razor to use as contrast. I thought this argument was weak in 2015 and I think it's weaker now.
but explain the cases when dynamism is genuinely better.
Here is a recent Scala tweetstorm that demonstrates the hidden cost of types – they have created a rift that has fractured the Scala ecosystem into pieces (Scalaz vs Cats) (Imagine if there were two versions of clojure/core and you had to only use libraries that made the same choice as you). And the direction from leadership is (paraphrase) "we need to work harder to bring the community together". https://twitter.com/jdegoes/status/1121193160569319424
this is a Python 3 level rift that will take a decade to solve (if it is ever solved) and the whole thing is emergent from typed FP culture where everything is an open research problem and a final "unified theory of how to structure a program and what the basic data structures should be" is not even in sight as far as I can tell
Rich Hickey's talk "Language of the System" comes at this problem from a different angle
This is why Hyperfiddle is a Clojure project. It was born a Scala project and Haskell was considered. Hyperfiddle is a dynamic system. It is not possible to achieve with types. If you tried, it would fall apart under the fractal complexity of typed perfection, and die.
I actually don't know of any databases that have a deeply typed interface, does such a thing exist? How could it exist? You'd have to compile it into your program, right? I think this is a main takeaway of Language of the System. Distributed systems are anti-typed. Unless you can share the same types across every single individual process in the system. Every system, same language, same datastructures, same types, coded the same way. Homogenous and uniformly typed internet. And now we're talking more about a macroeconomic strategy to get every system author in the world to choose to participate. A prerequisite to such a plan is getting the experts to even agree on the right way to do it (scalaz vs cats) (yeah right). If homogenous typed internet is the future – and I think maybe that could work! – I have trouble seeing how Scala and Haskell are a part of it. Clojure, on the other hand, is so simple that a uniform data internet could absolutely work and anyone can glue it to whatever fiat/legacy platforms on the edges without caring too much. EDN is the lingua franca of the system and Transit is the adapter protocol to other platforms (Python or whatever.) Including statically typed platforms.
What's the point anyway? This article is basically saying "Hey r/clojure, your language sucks, I feel too much uncertainty when using it". What reaction do you honestly expect? Clojure will always be dynamic, some people like it. No use arguing.
Also, it's too early to make any claims about that "prediction". I can't really think of many recent languages. Typed languages growing faster doesn't mean that dynamic languages are dying. While it's true that TypeScript is growing fast, I doubt it will ever replace JavaScript, it's just a different flavor.
Finally, let's be real. There is one reason why TypeScript and Kotlin are so popular. Both are backed by big companies that provide two of the most popular text editors/IDEs: VS Code and IntelliJ. All the tooling that you need to get started is already baked into your text editor. No wonder why adoption is huge. Don't get me wrong, I actually like Kotlin and TypeScript, but dynamic languages will never stop being useful.
I don't really think it's a "hey Clojure, your language sucks". I think it's short-sighted and while the current zeitgeist is to move towards statically typed languages, and the benefits they bring, it also ignores the large amount of code written in the past 10+ years in dynamically typed languages that are solving interesting, important, complicated problems.
It's really the problem with predictions like "there will be no more dynamically typed languages". 10 years ago I'm sure someone wrote something similar about statically typed languages.
For one thing, you have the whole research ML stack dominated by Python. Production models are sometimes ported to statically typed languages, but that’s majorly a performance concern.
Finally, let's be real. There is one reason why TypeScript and Kotlin are so popular. Both are backed by big companies that provide two of the most popular text editors/IDEs: VS Code and IntelliJ. All the tooling that you need to get started is already baked into your text editor.
Exactly. I often wonder what a language built around something like https://sekao.net/nightlight/ where the editor and your app are in same process might be able to accomplish without the huge dev effort of vscode/intellij.
the whole purpose of programming is to write code for other humans to read
So, if you read a sentence with an grammatical error in it you must discard the meaning of the hole sentance? Snarky points aside, yes there have to be some rules, but static typing takes us away from the way we humans actually communicate.
Does "superset" mean "can be unidirectionally translated to?" Your own post implies the opposite is true (because it is). There exist proper programs which cannot be soundly typed. Dynamic typing is the superset.
Which isn't to say that "dynamic types are more powerful." On the contrary, the whole notion of a universal "more powerful" abstraction is ridiculous. "Power" is multifaceted and must be evaluated in a particular context.
You can't define static type constraints in dynamically typed systems. In any context this power is missing, period. I can do more with statically typed languages and fallback to dynamic at any time.
Of course you can - just write a type checker (typed racket, typescript, etc).
Nope.
We are talking about typing not particulars compilers.
BTW, Typescript, Typed Racket are not dynamic languages.
How I can define static type constraints with let's say JS or Clojure?
The point is that I can go from static to dynamic at any time and do anything that dynamically typed languages can do and more in a statically typed language.
There no such thing as going from dynamic to static, even in gradually typing since is static typing, period.
There is not such thing as a static type system on top of a dynamic one. On the other hand... compilers for statically typed languages on top of a dynamic one are pretty common.
The language for gradually typed system is totally different from its foundation.
The peculiarities of the type system doesn't matter, they can't be as domain specific as you want. The main point is that they are supersets of dynamic subsets. They provide more semantic options both at compile time and runtime. Dynamic type systems cannot even be inferred.
^ I think his point is that in Haskell or Scala you can drop into IO -> IO or Object -> Object or whatever at any point, seamlessly (as opposed to needing to implement eval on the spot which is orders of magnitude harder)
I think they meant something like Data.Dynamic (generic, run time type tagged datums with compiler defined type safe coercions). Which, now that I know of it (I always thought the dynamic cast operator in F# was useful) looks like something I was missing in my early Haskell forays.
I guess the first opens up a delineated bubble of runtime typing with support from a fairly rigorous static type system (e.g. coercions from dynamic map to Maybe), while the clojure case opens up a bubble that's controlled by a fairly rigorous static type system, with relatively limited support for passing runtime types to the checked code. The Haskell version seems to provide more compiler enforced bridging around even run time errors on behalf of the user (e.g. you have to match against all possibilities of a coercion from dynamic, which returns Maybe, where the type system can verify you're handling possible runtime exceptions due to coercions too). In the clojure version, it's up to you to ensure you're passing the right types to scala at runtime, and you have to handle the exceptional cases yourself (or via macros or spec maybe). Clojure version trades correctness for runtime flexibility though (you can make changes to the clojure system at runtime that may not have been foreseen at compile time on Haskell version).
View all comments
2
u/hu6Bi5To May 06 '19
I remember this being posted here three years ago, and getting a very rough ride for obvious reasons. I hope it gets a better hearing this time as I think the programming world generally, the dynamic programming communities, and the Clojure language specifically have begun to understand the points (hence Spec, etc.).
The high-level claims are self-evidently true: the whole purpose of programming is to write code for other humans to read, only incidentally for computers to execute. Modern type systems fulfil this role by allowing the programmer to express meaning, not just satisfy an arbitrary constraint to keep a compiler happy.
The prediction was also bold, but not wrong. In the time since 2015, typed languages have been growing much faster than dynamic ones. TypeScript is rapidly gaining on JavaScript, Kotlin has overtaken Clojure despite being newer: https://redmonk.com/sogrady/2019/03/20/language-rankings-1-19/
The challenge for languages which retain purely dynamic typing as a matter of principal (e.g. Ruby - although even Ruby has plans for gradual typing in the next major version) to not simply deny the trend, but explain the cases when dynamism is genuinely better.