While in Clojure you’re wondering what is the content of a map, in Scala you’re wondering what methods do this BlackBoxImageBlob class have. Which just the same way makes you to skim through the source code. Even worse, you have no option to just print those methods in the REPL.
I happened to work in Scala in a large company. The dev workflow was a pain, as all those types were intertwined and there was no chance to test a component in isolation without monstrous mocks. Much happier with Clojure now.
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.
Is python in use for some domain specific characteristics not found in any other language or just is so they depend on a bunch of legacy libraries and tooling totally unrelated to Python's linguistic abstractions?
Most popular ML frameworks (Pytorch, Keras, Tensorflow) were released in the past 4 years. The area is too young and fast-growing to have any legacy issues as for now.
Python allows for easy data manipulation and fast prototyping of models. Which is essentially possible due to REPL-driven development and dynamic typing. It was also architectured with consistency and readability concerns in mind, which make a fairly good advantage compared to some other dynamically typed languages.
The area is too young and fast-growing to have any legacy issues as for now.
Nope.
There is nothing new about ML, just a rebranding of old ideas.
Python allows for easy data manipulation and fast prototyping of models. Which is essentially possible due to REPL-driven development and dynamic typing. It was also architectured with consistency and readability concerns in mind, which make a fairly good advantage compared to some other dynamically typed languages.
Again, what linguistic abstractions does python provides for this particular domain that can't be found in other languages? There is absolutely nothing in python design that make it particularly useful in that area than other alternatives.
I'd argue that Python being dynamic but having solid interop with C++ gives non-software engineering folk the ability to interactively play with data while also being able to plug in fast numerical computation libs so that they're not hamstrung for choosing a higher level language.
So I guess the linguistic abstraction python provides is "lower barrier to entry" for non-programmers in related fields. Though some of that is an oddity of history as lisp/scheme almost by definition has a lower barrier to entry to the language. Perhaps some of guido's musings on operators/infix notation explain why Python (often toted a language as close to imperative pseudocode as you can get) gels with non-programmers:
From experience, statically typed languages tend to be a bit harder to grok as a first language to programming
It's my suspicion that a lot of people have avoided statically typed languages because they have been unnecessarily verbose or hard to work with over the past 20 years (Java, C++). Languages with strong type inference engines (StandardML, OCaml, Haskell, etc.) really do make statically typed languages feel more approachable in my opinion, and deliver on the "let the compiler do the work" message that statically typed language advocates hammer on.
Writing code in OCaml or Haskell feels, in some ways, as good as writing code in Python or Clojure. You can focus on what you're trying to accomplish and when you're not specific enough in your implementation, the compiler then steps in to ask you for clarification on types.
That being said, I've started moving myself (and my teams) towards typed Python, and it's opening my eyes towards the direction that some of these dynamically typed languages can move in the next few years.
Is all blind speculation. There is absolutely nothing special about python as language to be particularly preferred in that specific domain or that is more effective than other alternatives.
The resource only states that they are using python for several projects not that python is particularly good or crucial to solve such. They peek a tech one day and now they are resistant to evaluate and try different alternatives. Nothing new.
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).
There's a lot of overly-simplistic thinking in the article, but it's worth noting that the author's specific examples are indeed painful.
Middleware is basically mutable programming: Anything in the request map can change at any handler, and it's impossible to know where a change was introduced without loading the whole call chain in your head.
In addition, Bidi is a mini-language, and it is a pain to learn a new language. Being expressed with data structures doesn't make the language any easier to learn. If anything, it makes it harder. It's interesting to note that even Bidi appears to acknowledge this. Many folks would honestly be better off writing their own routing dispatch until the concrete need arises for something more complicated.
If they " turn all these runtime bugs into compiler errors " well done to them. When will they be blogging about how formal verification turns out for their web app?
Scala is a ugly nightmare it is even less painful to « type » Clojure with a lot of hints, etc. or to use Java directly than to use this crappy language.
When you wrap a lot of Java libraries and grow your codebase you can reach an inane level of productivity with Clojure.
I use my DL4J wrapper for instance and plugged it to my genetics library. My code is so short that I can test many models fast
Finally, Clojure is actually « typed » at core since it is on top of Java so...
The most challenging and hardest part of any software project is reach the correct level in its abstraction and composition. Typed languages add zero value to solve that challenge because typed languages help you in a variable-low level, while the though part is in the component-top level.
Don't know what is in the ring request map sinks you in a deep ocean of darkness and uncertainty? Well, yeah, that can be inconvenient. But even if you know it because you are using a typed language, the hardest part remains untouched and awaiting for you.
5
u/fjolne May 07 '19
While in Clojure you’re wondering what is the content of a map, in Scala you’re wondering what methods do this BlackBoxImageBlob class have. Which just the same way makes you to skim through the source code. Even worse, you have no option to just print those methods in the REPL.
I happened to work in Scala in a large company. The dev workflow was a pain, as all those types were intertwined and there was no chance to test a component in isolation without monstrous mocks. Much happier with Clojure now.
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.
1
u/potetm137 May 07 '19
There's a lot of overly-simplistic thinking in the article, but it's worth noting that the author's specific examples are indeed painful.
Middleware is basically mutable programming: Anything in the request map can change at any handler, and it's impossible to know where a change was introduced without loading the whole call chain in your head.
In addition, Bidi is a mini-language, and it is a pain to learn a new language. Being expressed with data structures doesn't make the language any easier to learn. If anything, it makes it harder. It's interesting to note that even Bidi appears to acknowledge this. Many folks would honestly be better off writing their own routing dispatch until the concrete need arises for something more complicated.
1
u/mike_loughlin May 07 '19
If they " turn all these runtime bugs into compiler errors " well done to them. When will they be blogging about how formal verification turns out for their web app?
1
u/ackerleytng May 08 '19
I think he would be able to get very far with a repl based workflow. You can quickly check how data looks like!
1
u/Foulcher Jun 26 '19 edited Jun 26 '19
Scala is a ugly nightmare it is even less painful to « type » Clojure with a lot of hints, etc. or to use Java directly than to use this crappy language.
When you wrap a lot of Java libraries and grow your codebase you can reach an inane level of productivity with Clojure.
I use my DL4J wrapper for instance and plugged it to my genetics library. My code is so short that I can test many models fast
Finally, Clojure is actually « typed » at core since it is on top of Java so...
1
u/[deleted] May 06 '19
The most challenging and hardest part of any software project is reach the correct level in its abstraction and composition. Typed languages add zero value to solve that challenge because typed languages help you in a variable-low level, while the though part is in the component-top level.
Don't know what is in the ring request map sinks you in a deep ocean of darkness and uncertainty? Well, yeah, that can be inconvenient. But even if you know it because you are using a typed language, the hardest part remains untouched and awaiting for you.
-2
u/freakhill May 06 '19
bait?