TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Dynamic languages are static languages

54 pointsby gaiusparxabout 14 years ago

15 comments

tompabout 14 years ago
This article is full of FUD and completely misses the point of static/dynamic distinction (flame-war, if you want). It's a perfect example of someone arguing to make a point without even trying to understand the opposite position.<p>No one has ever argued that dynamic languages are more expressive than static languages. This is impossible, as long as we're considering Turing-complete languages. The fact that Harmony/EcmaScript 5 reference compiler was implemented on OCaml. However, it is equally futile to argue that they are <i>less</i> expressive[1].<p>"you are imposing a serious bit of runtime overhead to represent the class itself [...] and to check [...] the class [...] on the value each time it is used."<p>Users of dynamic languages simple trade runtime efficiency for compile-time efficiency. What's wrong with that?<p>The point of having multiple languages is that different languages make different things simple and easily expressible. Sure, you can do dynamic programming in Haskell or OCaml, but the language is going to work against you in some way, requiring you to specify your intension in a particularly lengthy and awkward way (think Java, except Java makes you do that for any kind of programming).<p>[1] Ironically, the author fails to point out the one way in which static languages are more "expressive" than dynamic languages: overloading on function's return type. I have yet to see that in a dynamically typed language.<p>tl;dr: All Turing-complete languages are equally expressive, but different languages make different things simple.
评论 #2347582 未加载
评论 #2347296 未加载
baddoxabout 14 years ago
This is an impressive and informative argument. It's a shame that it's aimed at a straw man.<p>I use the term "dynamic language" to refer to a well-recognized (though not perfectly agreed upon) set of languages. I didn't choose the term "dynamic," and I've never tried to argue that since they're <i>dynamic</i>, they're better/more fun/more expressive than non-dynamic languages. Hence the straw man.<p>I use the term simply to distinguish between, say, the set {Java, C, C++} and the set {Python, JavaScript, Ruby}. Most people are aware of this usage and immediately understand the distinction. You could call the latter set "cranberry languages" instead of "dynamic languages" and it would be okay. As long as everyone understands the usage, it's a functional (no programming language pun intended) term.
评论 #2347108 未加载
mcantorabout 14 years ago
I <i>found</i> this <i>article</i> extremely <i>difficult</i> to read, as he seemed more <i>concerned</i> with <i>enunciating</i> through italics than with <i>expressing</i> his <i>point</i> in a <i>clear</i> and <i>unambiguous</i> manner.
评论 #2347404 未加载
warrenwilkinsonabout 14 years ago
Funny how he treats 'static typing' as the natural order and 'dynamic typing' as the special case. I would have pegged it the other way round. Machines are typeless, its all numbers until somebody puts (or doesn't put) a type system on it.<p>Plus it's rather meaningless. Bald is a hair color. Clear is a paint color. Silence is a syllable.
评论 #2347294 未加载
cscheidabout 14 years ago
As pointed out in a comment on the original, this is a well-known source of holy wars.<p>The interesting bit is that this argument is one of the sides of an equivalence. Dig up the old archives of LtU,<p><a href="http://lambda-the-ultimate.org/classic/lambda-archive.html" rel="nofollow">http://lambda-the-ultimate.org/classic/lambda-archive.html</a><p>and search for the big threads. This direction of the argument (dynamic languages are static languages) was made most forcefully, in my recollection, by Frank Atanassow.<p>However, the other direction _also_ applies: static languages are dynamic languages. This was first pointed out in LtU, to the best of my memory, by Kevin Millikin, here:<p><a href="http://lambda-the-ultimate.org/node/100#comment-1197" rel="nofollow">http://lambda-the-ultimate.org/node/100#comment-1197</a><p>Someone ought to write up the old days of LtU holy wars somewhere. They taught me more about programming languages than everything I ever read anywhere else.<p>(edit: minor wording)
评论 #2347364 未加载
rleistiabout 14 years ago
One of the things that a 'dynamic' type system (or as the author would see it, a restriction to a single type) imposes on its creators is the need to make that single type as useful as possible. This includes things like being able to easily lookup an object's class, documentation, methods, properties, uses (is it a sequence? is it a map?, etc.). As a result, I find the design of the core libraries of dynamic languages like Clojure more well thought-out than say something like .NET. It's simple things like being able to treat a string as a sequence (Haskell, a statically-typed language, does this), an 'object' as a map, a map as a sequence, etc. I wonder if it has to do with a sort of de-centralization of control; being dynamic seems to make a language more malleable and open to experimentation. Accomplishing the same things in a statically-typed language requires more planning (which means that after it ships, its too late).<p>I really appreciate a well-thought out static language like Haskell, but it still has some way to go for the common programmer. For now, I don't think that the practical outcome of this article is for programmers to abandon dynamic languages.
评论 #2347503 未加载
评论 #2347093 未加载
Argorakabout 14 years ago
To paraphrase an old joke about mathematicians: "He must be a computer scientist!" "How do you know?" "His answer is absolutely correct, but has no practical value."<p>Most of the points he makes do not touch any practical problems of this devide. For example: How do I get my XUnit tests to run if one of the functions/methods/whatever in a file does not compile because the software has changed? Ruby really excells at that: it fails at runtime. Java? Not so, it will break my whole test file at compile time. Any other number of similar examples can be found. Yes, its a problem that the language marrying both of these properties has not been found yet. But Haskell certainly isn't the one.<p>Also, the much respected Erik Meijer made a similar point long ago in a much better fashion: <a href="http://lambda-the-ultimate.org/node/834" rel="nofollow">http://lambda-the-ultimate.org/node/834</a>
评论 #2347459 未加载
stefanoabout 14 years ago
"Now I am fully aware that “the compiler can optimize this away”, at least in some cases, but to achieve this requires one of two things (apart from unreachable levels of ingenuity that can easily, and more profitably, be expressed by the programmer in the first place). Either you give up on modular development, and rely on whole program analysis (including all libraries, shared code, the works), or you introduce a static type system precisely for the purpose of recording inter-modular dependencies."<p>Or you can use a tracing jit. You monitor at runtime the actual values taken by the variables and produce type-specialized code.
ScottBursonabout 14 years ago
"Since <i>every</i> value in a dynamic language is classified in this manner, what we are doing is agglomerating <i>all</i> of the values of the language into a single, gigantic (perhaps even extensible) <i>type</i>."<p>Yes, that's right, but you're overlooking the upside of doing things this way. What this gives us is the ability to define new types -- to extend the universal type, if you want to put it that way -- <i>at runtime</i>. No longer do we need this strict separation between compilation time and runtime; no longer do we need the compiler to bless the entire program as being type-correct before we can run any of it. This is what gives us incremental compilation, which (as I just argued elsewhere, <a href="http://news.ycombinator.com/item?id=2345424" rel="nofollow">http://news.ycombinator.com/item?id=2345424</a>) is a wonderful thing for productivity.<p>"[...] you are depriving yourself of the ability to state and enforce the invariant that the value at a particular program point must be an integer."<p>This is just false. Common Lisp implementations of the CMUCL family interpret type declarations as assertions, and under some circumstances will warn at compile time when they can't be shown to hold. Granted, not every CL implementation does this, and the ones that do don't necessarily do it as well as one would like; plus, the type system is very simple (no parametric polymorphism). Nonetheless, we have an existence proof that it's possible at least some of the time (of course, it's uncomputable in general).<p>"[...] you are imposing a serious bit of run-time overhead to represent the class itself (a tag of some sort) and to check and remove and apply the class tag on the value each time it is used."<p>For many kinds of programming, the price -- which is not as high as you suggest, anyway -- is well worth paying.<p>In particular, dynamicity is <i>necessary</i> whenever data live longer than the code manipulating them. If you want to be able to change the program arbitrarily while not losing the data you're working with, you need dynamicity. In dynamic languages, the data can remain live in the program's address space while you modify and recompile the code. With static languages, what you have to do is write the data into files, change your program, and read them back in. Ah, but when you read them in, you have to check that their contents are of the correct type: you've pushed the dynamicity to the edges of your program, <i>but it's still there</i>.<p>For this reason, database systems -- the prototypical case of long-lived data -- have to be dynamic environments, in which types (relational schemata, e.g.) can be modified without destroying the existing data.<p>So to argue -- rather arrogantly, I might add -- that dynamic languages are really static languages is to overlook an operational difference that is a commonplace to anyone who uses both.
评论 #2346959 未加载
评论 #2347134 未加载
评论 #2347332 未加载
jarinabout 14 years ago
"Another part of the appeal of dynamic languages appears to be that they have acquired an aura of subversion. Dynamic languages fight against the tyranny of static languages, hooray for us! We’re the heroic blackguards defending freedom from the tyranny of typing! We’re real programmers, we don’t need no stinking type system!"<p>I don't know anyone who prefers dynamic languages who actually thinks this way. I program in both statically- and dynamically-typed languages, and I prefer dynamically-typed languages because it's less code I have to write.
评论 #2348864 未加载
kenjacksonabout 14 years ago
Good blog entry.<p>I do like the direction C# is going with the dynamic type. I want a statically typed language, but I want the ability to have dynamically extensible type classification -- when I want it.
评论 #2346852 未加载
sophaclesabout 14 years ago
Here is why the article doesn't make sense to me: I frequently find that languages in the "dynamic" group (python, ruby, js, smalltalk etc) feel much, much more similar to languages in the "ultra strict" type group (haskell, ocaml, etc), than either do to say, the medium group (c(#|+)*, java). If the case were really that there is some sort of natural order along the type strictness lines, wouldn't it be that python felt closer to c than to haskell in terms of power and expressiveness?
评论 #2347762 未加载
评论 #2348491 未加载
评论 #2347731 未加载
评论 #2347441 未加载
jasonwatkinspdxabout 14 years ago
While the basic perspective of this post is interesting, I find the authors rhetoric entirely off-putting.<p>Example:<p><i>"There are ill-defined languages, and there are well-defined languages. Well-defined languages are statically typed, and languages with rich static type systems subsume dynamic languages as a corner case of narrow, but significant, interest."</i><p>I would like to see justification for the claim that there does not exist a single well defined language with runtime type enforcement.<p>This tone runs through the entire article, which is mostly begging the question rather than supporting the premise. I'd love to see the author's point illustrated by contrasting Haskell/ML and Python/Scheme/Ruby code listings or something similar.<p>Instead the article merely restates its premise in an attempt to make an impression, rather than to inform. Disappointing.
kunleyabout 14 years ago
Author apparently knows has knowledge and experience, but attributing psychological traits to tools like programming languages is a poor trick and a fallacy.
feddabout 14 years ago
&#62; That’s one argument, and, to be honest, it’s quite a successful bit of marketing.<p>who markets the dynamic languages? pls show me this person/firm. i'll try to hire them