6 ms·
The popularity of dynamic typing, I think, was at its peak around 2010, mostly due to the purported rediscovery of the "good parts" of the only client-side lang
by paxcoder 10y ago
The popularity of dynamic typing, I think, was at its peak around 2010, mostly due to the purported rediscovery of the "good parts" of the only client-side language for the web, the unprecedented acceptance of Python by academia, and the popularity of Ruby on r..the web (but PHP as well). Around the time that asm.js started being discussed, however, the trend was reversed: Though it may have made the benefits of static typing obvious, need for speed wasn't what replaced the likes of CoffeeScript with the likes of TypeScript. As web applications became more complex, the old Large Systems called for safety guarantees. Industrial languages never even considered losing their types, while improving considerably by adopting functional concepts. Nowadays I see no notable arguments for dynamically typed programming languages. With the exception Fowler's 2005 testing argument being reiterated, static typing is no longer being challenged. The new kids: Go, Rust, Swift - they all indicate that the errors will not be left to the runtime (or the unit test). It seems to me that the advocacy has been reduced to voicing personal preferences. I may still provoke the bold claim of there being "severe failure of static typing", but without any arguments, the default today is going to be to discount the claim, on account of the probability that it has merits that outweigh type safety alone.
I have only used a JS live environment (the browser console) but I hope you have in mind something that my static language's debugger cannot do. I assume the next two languages are about reflection - I've done some. Finally, I'm unfamiliar with the Erlang's static analysis tool and I don't know Racket's contracts, but I'd like you to tell me how they differ and why you think they're better than my own.
- jhbadger 10y agoI wonder if this is a generational thing. Learning programming in the 1980s with Pascal, static typing was just seen as a fact of life. When I discovered dynamic typing/scripting languages in the 1990s it was a revelation -- it made programming much more productive and perhaps equally as important, fun. The current generation grew up on scripting languages and now this current return of static typing is seen as something new and exciting rather than a return to the old days. Computing has recurrent ideas/fads. In the 1970s/1980s, a popular strain of Pascal was UCSD Pascal, which ran on a virtual machine (the p-machine). People realized that this was inefficient and moved to native binaries. Kind of what's happening now with JVM and .NET as the new wave of programming languages make native binaries again.
- klibertp 10y ago> It seems to me that the advocacy has been reduced to voicing personal preferences. It was like this from the beginning. Almost all arguments about type systems center around how "useful" the type system is. This is obviously a problem: the usefulness is a subjective notion! Two people with different preferences (and/or in different circumstances) may disagree about how useful some particular type system is - and they could be both right, at least for their use cases. This makes the discussion hard and tiring. For dynamic typing people, static type systems are limitations which need to be subverted before they can code using their preferred techniques. For static typing people, types are tools which allow them to code the way they like. It's entirely subjective matter. In effect, it is almost impossible to "convince" people without first broadening their technique sets. There is literally no good argument for the other typing kind if you continue writing code dependent on the previous typing scheme. And when you master techniques from both sides you tend to realize the subjectivity and become disinterested in the topic, which doesn't help the quality of the discussion... > Nowadays I see no notable arguments for dynamically typed programming languages. A quick Google brought up an article from Dec 2016: https://medium.com/javascript-scene/you-might-not-need-typescript-or-static-types-aa7cb670a77b#.1o9vouhah https://medium.com/javascript-scene/you-might-not-need-types... > The new kids: Go, Rust, Swift What about Elixir and Clojure? Not to mention, the dominant platforms (JVM, CLR) getting better support for dynamic languages? > I may still provoke the bold claim of there being "severe failure of static typing." I think you interpreted my statement too broadly. What I said was that dynamic typing systems are being created in response to a particular (class of) programs which are correct, yet rejected by the static type checker. Such rejection is viewed as a "failure" of static typing, that's all. > I hope you have in mind something that my static language's debugger cannot do. No. There's nothing you can do in one language and definitely cannot in another, as long as the languages are both Turing-complete. You can write an interpreter for a dynamically typed language in a statically typed one and a statically typed language preprocessor (type checker) in a dynamically typed one. I mentioned Racket contracts because of the research and work that went into a statically typed dialect of Racket, the TypedRacket language. One of the goals of the project was seamless interop with dynamically typed Racket while providing the safety guarantees in both worlds. This resulted in the automatic generation of contracts out of types. This is an impressive example of an argument for dynamic and static type systems equivalence. I mentioned Dialyzer because of the notion of "success typing". Dialyzer is a static type checker, which only rejects programs it knows for sure will result in error. Traditional type systems require the programmer to supply the proof that the code is correct and will refuse to type check without one. Dialyzer is optional, meaning you can provide the types or not and it will accommodate. It gives many of the advantages of static typing without being a pain. I mentioned Forth and Assembly because these are the only languages I know of (TCL may also qualify) which are truly unityped. I suppose you'd like dynamic typing more after working with something which lacks any kind of types. I mentioned live environments of Smalltalk and Lisp because they provide the tools which rival (and, frankly, beat) the tooling enabled by static type systems. These environments are designed to be always running, you load your code and changes into the running image. Combined with reflection and introspection, it allows for the most accurate auto-complete you've ever seen: at any point, you know exactly which classes have which methods. The refactoring tools of Smalltalk are legendary and are possible only because the code itself is a part the running image and may be queried and changed programmatically (at run-time). Gilad Braha has some good talks on the advantages of a live environment over a static one. Well, in any case, you shouldn't wait to "get convinced" by someone. You should try to learn the dynamic typing side of things on your own and use it for a while. It will make you a better programmer overall, even if you get back to static typing later.
- vorg 10y ago> With the exception Fowler's 2005 testing argument being reiterated Besides testing, dynamic languages can also be good for glue code, or scripts for builds. Just don't use them to write systems. Of course, when a script starts becoming a system is vaguely defined. I think the best way is to always be ready to pull some logic out of a script into its own system whenever a script starts getting too big.
- kazinator 10y ago> As web applications became more complex, the old Large Systems called for safety guarantees. I.e. "we can't possibly test the cases occurring in this mountain of code, so let's make it type check, and if it's clean, let's call it correct and ship it".