9 ms·
The sky is not falling – about the supposed end of dynamic languages
- rdudekul 11y agoI love Ruby, Python and JavaScript. I believe I am more productive with dynamic languages than say static languages like C# or Java. The abstractions in dynamic languages (at least for me) allow me to write less code with less confusion and less classes to remember. With so many libraries supporting my development, I usually tend to write much less code using a dynamic language. Also most of the code tends to be isolated with clear interfaces exposed to other parts of the code. Writing tests is simpler too, compared to writing them in dynamic languages. May be large projects with hundreds of thousands of lines of code, could benefit from statically typed languages. But for majority of the projects (80-20 rule) dynamic languages offer cleaner syntax, simpler coding experience and faster time to market (my opinion).
- tormeh 11y agoDude, you're comparing specific languages you're naming, rather than comparing dynamic and static.
- jack9 11y agoHe grouped them by dynamic ones (the scripting languages) and the statically typed ones.
- wtetzner 11y agoBut the two typed languages are ones that have poor type systems. I'm more productive in OCaml than I am in Ruby or C#.
- Avshalom 11y agoArguments in favor were: less confusion, less classes, more libraries, cleaner interfaces and easier testing. Of those classes and libraries obviously apply per language not per typing discipline, confusion was rhetorically tied to the number of classes so again, thats about the language not the typing. tormeh's right, the comparison was between languages, not between typing.
- stephen 11y ago> dynamic languages offer cleaner syntax Solely for syntax, my assertion is that this is just because dynamic languages evolve faster. Because they are easier to build. E.g. one person can buy the dragon book(s), use parser/lexer libraries, get an AST, and then start an interpreter than just stores objects as maps, and evals things dynamically. But very few people are going to write a new/novel type system on their weekends. So that's why, IMO, all the sexy/modern syntax shows up in dynamic languages first, and then takes ~a generation or two to reach static languages, where you need a dedicated team to put the effort into the type system + compiler + expected tool set (IDEs/etc.). (E.g. see Scala, Kotlin, Rust, etc., which have all, IMO, achieved the "syntax as nice as Ruby" level, but took large teams of people to do it).
- marcosdumay 11y ago> But very few people are going to write a new/novel type system on their weekends. No, but one can hack an extension to the GHC type system in a weekend. (That's one of the reasons why there are so many.)
- Veedrac 11y ago> see Scala, Kotlin, Rust, etc., which have all, IMO, achieved the "syntax as nice as Ruby" level I've only reasonable experience with Rust in that list but... no. I've seen enough Scala to get that that's not true, and I know it's not true for Rust. That's not to say that static languages can't have nice syntax - Crystal is a great example if you'r trying to match Ruby - but I don't think your examples are great.
- yogthos 11y agoI simply question writing projects using a monolithic style in the first place. Anytime somebody brings this up as an advantage of static typing I get a little suspicious. In fact, it could be argued that static typing gives the user enough rope to hang themselves with. With dynamic typing you're much more likely to break things up early precisely because you know you have to keep things in your head. On the other hand, static typing allows you to just keep adding code and it makes sure that the code will compile and run. However, at some point you end up with a large and complex system that you don't really understand. All you know is that it's self consistent. Understanding what the business logic is doing and why can be quite difficult and the fact that it type checks does little to help you there. Coincidentally this is the reason that static typing proponents are obsessed with refactoring. Once you realize what mess you got yourself in then you have a ton of code to refactor and there's no way you can keep track of it all in your head. With a dynamic languages refactoring tends to happen in much shorter cycles and introduces much less cognitive load.
- incepted 11y ago> With dynamic typing you're much more likely to break things up early precisely because you know you have to keep things in your head. If you are programming with a language that forces to keep everything in your head, you'll never build big systems.
- sitkack 11y agoThe kind of code you could only write while on holiday in Cambodia.
- yogthos 11y agoYou mean you'll never build a monolith. In practice, I've been working on big systems in Clojure for the past 5 years. They just happen to be broken down into manageable components you can work on and reason about in isolation.
- incepted 11y ago"I" makes me think you've only ever worked solo on Clojure projects, is that correct?
- js8 11y agoThe post is kinda like saying, you don't really need to understand notions of convergence or measure to be able to do integration. It's true, in a sense, and it's faster to just learn Newton's formula and get the job done. But you may get into problems without good foundations. I like dynamic languages, especially Python and Clojure. But programming with types is important to get things right, on the correct, formal basis. (I think functional programming is a misnomer, it should really be called algebraic-oriented programming, but I digress.) Once you see how to do it correctly it's perfectly OK to mimic the same abstraction in dynamic language.
- yogthos 11y agoYou can reason and prove code to be correct in a dynamic language. What static typing gives you is compiler assisted proving. The cost of the compiler assistance is that you have to express the code in a way that often makes it more difficult for a human to understand.
- js8 11y agoYou can do it, but you don't. It's not a language thing, it's a culture thing. Language like Haskell forces you to do it. It is more effort, but this effort pays off in getting composability and edge cases right. The end result is not actually harder to understand, it's rather that you did not fully understood the problem in the beginning (by glossing over technical details).
- yogthos 11y agoAh but the thing is that the payoff is simply assumed. Nobody has actually shown this claim to be true. You spend more effort and you hope that there is a payoff. Yet you have things like Cabal that's as flaky as anything written in PHP. Clearly static typing isn't some magic pixie dust that all of a sudden makes all your code work correctly.
- js8 11y ago> Clearly static typing isn't some magic pixie dust that all of a sudden makes all your code work correctly. Static typing itself - no. What is important about Haskell is the equational reasoning (algebraic thinking, if you will) you can do, not static typing. Static typing is just a vehicle to be able to pull it off. There is a payoff already - see my comment to Lisp guy above. We could also talk about how monads made LINQ great, or how streams in Java have to be more complicated than necessary because the language wasn't very well formally defined. And there will be bigger payoff in the future, when we will learn for example how to type a whole big software component correctly (like a web service). So far, it's an art driven by engineering intuition; but formalization will help to make more robust systems. The payoff is also assumed based on experience with other branches of mathematics (as I was alluding in my first comment), where historically, the formalization always paid off. It doesn't mean you cannot get things right informally, but it's usually fiendishly difficult.
- sanxiyn 11y agoAll examples in the post is Haskell. I think static typing is good, but Haskell is bad. Let me quote Ben Lippmeier's words in his PhD thesis: "I am thinking of a data structure for managing collections of objects. It provides O(1) insert and update operations. It has native hardware support on all modern platforms. It has a long history of use. It's proven, and it's lightning fast. Unfortunately, support for it in my favourite language, Haskell, appears to be somewhat lacking. There are people that would tell me that it's not needed, that there are other options, that it's bad for parallelism and bad for computer science in general. They say that without it, programs are easier to understand and reason about. Yet, it seems that every time I start to write a program I find myself wanting for it. It's called the store. The mutable store, that is. I want for real destructive update in a real functional language. I wanted it for long enough that I decided I should take a PhD position and spend the next several years of my life trying to get it." http://benl.ouroborus.net/papers/thesis/lippmeier-impure-world.pdf http://benl.ouroborus.net/papers/thesis/lippmeier-impure-wor... While I admire him, I think the better solution is to give up Haskell.
- tome 11y agoWell, er, Haskell does have destructive update. You are misunderstanding Ben's point is somewhat. "We present a type based mutability, effect and data sharing analysis for reasoning about such programs [containing mutable data]". https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-IORef.html https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-I... https://hackage.haskell.org/package/base-4.7.0.2/docs/Data-STRef.html https://hackage.haskell.org/package/base-4.7.0.2/docs/Data-S...
- sanxiyn 11y agoHow am I misunderstanding? I am quoting exact words, after all. Re IORef and STRef, let's quote some more: "Representing effects in value types is a double edged sword (p. 42). Haskell has fractured into monadic and non-monadic sub-languages (p. 44). Monad transformers produce a layered structure (p. 45)." These are section titles, be sure to read the entire sections which explain in details what the title means.
- jasode 11y agoJust in case anyone is reading the blogs in a hurry, keep in mind that neither the Dmitri Sotnikov nor the post he mentioned by Maxime Chevalier-Boisvert actually try to refute Elben Shira's carefully worded prediction: "This is my bet: the age of dynamic languages is over. There will be no new successful ones." Instead of making a case for "new successful dynamic languages" and why such new ones would emerge, both authors are defending the existing benefits of today's dynamic languages. Elben Shira is saying that he predicts the next wave of successful languages will have static checking but also look & feel like a "dynamic" one made possible by smarter compiler technologies such as type inferencing. (Maxime Chevalier-Boisvert also mentions the new Crystal language as an example of this.) If one is itemizing all the great points of Python/Ruby/Javascript, that's orthogonal to what Shira is betting on.
- adamors 11y agoElixir is a new dynamic language that is quite successful already.
- Avshalom 11y agoIf I may be pithy here: Erlang is reliable because it's fault tolerant. The Strong Static Typing camp wants software that is reliable because it is faultless. Elixir has Erlang's philosophy on the problem. I think most of the wailing and gnashing of teeth is because most languages (even most statically typed ones historically) have just completely punted on the notion of language support for writing software that doesn't fall over in a stiff breeze. The more we build layers of software between humans and their actual goals the more this is going to come to a head.
- yogthos 11y agoThe Strong Static Typing camp appears to be blissfully oblivious of Gödel's incompleteness theorems. :)
- marcosdumay 11y ago
- lisper11 11y agoThe age of dynamic languages will be over when you see a modern static language that supports self-modifying runtime environments as well as Common Lisp or Smalltalk presently do. This is an area where the state-of-the-art in static languages (Haskell, Idris, Agda) falls flat, and I suspect that's why (other than ignorance) we see so many comparisons from Haskell advocates between Haskell and the likes of Python, Ruby, or worse that try to paint dynamic languages as offering only brevity through the omission of type signatures as a major advantage over common static languages--an advantage for which Haskell can largely compensate--while completely ignoring the capabilities more sophisticated dynamic languages offer.
- solomatov 11y ago>The age of dynamic languages will be over when you see a modern static language that supports self-modifying runtime environments as well as Common Lisp or Smalltalk presently do. Example of such a language is Java. It's runtime is highly dynamic. Class loaders allow you to create new classes, pre-process bytecode, and many other stuff.
- js8 11y agoI used to think the same thing.. but then I read http://www.haskellforall.com/2012/06/you-could-have-invented-free-monads.html http://www.haskellforall.com/2012/06/you-could-have-invented... and my jaw dropped. This is a formal way to do homoiconicity, and frankly much better than codewalkers and CPS-conversions and similar tricks. I now think that everything you can do with macros in CL, you can do in Haskell too and it will be cleaner. Another good example are lens and traversals, they are generalizations of generic references such that CL can only envy. Someone should really rewrite On Lisp and Paradigms of AI in Haskell.. (and also Design Patterns from GoF) I think it would prove this point.
- incepted 11y agoThe JVM has supported the kind of environment you describe for more than a decade. Fire up IDEA or Eclipse, put a break point in your code and modify it at runtime at your heart content. You can even rerun portions of your code after you've modified it (rewind it), something that even Smalltalk never supported.
- bollockitis 11y agoErlang is probably not the best example. Programmers using Erlang are almost certainly of a different caliber than those using Ruby and Python. I don't think it's very productive to study dynamic versus static typing without also controlling for the experience and discipline of the programmer. This is an element that many of the academics want to ignore because it's difficult to quantify, but I wouldn't trust any argument that exluded the human element because it's ultimately humans who use these tools. I still haven't seen anyone address Elben Shira's original point about the difficulty involved in understanding the return values of a function: what's really in that immutable request map? How do I use it? Given experienced and disciplined programmers, the type system probably isn't as important. But given the quality of programmers who are using these languages in the real world, a good type system does seem to help.
- wtetzner 11y agoThat's the thing, experienced programmers are also better able to use the type system to encode program invariants, beyond just making sure you don't pass a string where an int is expected.
- yogthos 11y agoYeah, but do you seriously expect an inexperienced programmer to be able to drive a language like Haskell?
- nrinaudo 11y agoI've heard various CS teachers say that, when presented with Haskell as a first language, students took to it like a fish to water and could start writing useful code really fast. My personal experience is that Haskell isn't really all that complex - when you stick to the core, it's actually fairly simple, with a small set of well thought out features (compared to Scala, for example, which I love but has a lot of features). Strangely enough, what I find hard when dealing with Haskell is the syntax, because it's so different from all the languages I've been taught or taught myself in the past. That shouldn't be a problem for people that have little to no previous experience and tackle it with a virgin mind.
- solomatov 11y agoI think, instead of dynamic languages, the current place of dynamic languages in the future will be dominated by hybrid languages. Having no type annotations, even in highly dynamic languages, leads to lower maintainability. However, some type systems are too complicated, and over-engineered, the best example of which is Haskell (compare it to Agda or Idris, which can do more, but have much much simpler type system).
- jack9 11y agoI would say Java (the native syntax) is over engineered. The runtime is a beautiful thing.
- solomatov 11y ago>I would say Java (the native syntax) is over engineered. The runtime is a beautiful thing. It's not over-engineered. Making syntax in this way was a design goal. AFAIU, authors of the language thought that when you specify as much as possible in syntax, the code is easier to maintain. That's why it's so popular in enterprise world where code often lives for 10s of years.
- jack9 11y ago> when you specify as much as possible in syntax, the code is easier to maintain That's not true of all cases. Most importantly, the number of abstractions that are baked into the language are a combination of workarounds (rather than fixing the type system) and whatever the JLS contributor's motivations are. Some of which has been useful, some of which has not. It's overengineered.
- wtetzner 11y agoI don't know if it's overengineered, so much as it's poorly engineered.
- yogthos 11y agoI think gradual typing is definitely likely to become the norm. It allows you to develop things using the dynamic style and then add type annotations where appropriate. It also avoids the problem of mixing the proof into your solution.
- lisper 11y agoWhen people write Lisp code, they invent new dynamic languages all the time. Inventing and implementing new languages (a.k.a. writing macros) is just part of the regular course of doing business in Lisp. And these languages that people invent when writing Lisp tend to be dynamic, because they tend to compile to Lisp. But of course they don't have to be.
- nitrobeast 11y agoSome people may disagree, but Steve Yegge's "political axis" seems relevant here: https://plus.google.com/110981030061712822816/posts/KaSKeg4vQtz https://plus.google.com/110981030061712822816/posts/KaSKeg4v... https://plus.google.com/110981030061712822816/posts/iuRbQe6EoiK https://plus.google.com/110981030061712822816/posts/iuRbQe6E... I suppose no rationale person believes dynamic language would disappear completely. Also I think both dynamic and statically typed languages exist on a spectrum. It is not very productive to talk in generalized terms like "end of dynamic languages".
- birchb 11y ago"This is my bet: the age of dynamic languages is over. There will be no new successful ones." I wonder what Shira counts as "successful"? Popular? Sigh.