5 ms·
Modules Matter Most
- Roboprog 15y agoI'm sorry, that was too hard to follow. First give me the qualitative rundown of what you are trying to say, then give the the quantitative formula. And use symbols that a blub programmer can recognize in the formula, please. There's something in there about wanting a more flexible type system, but without completely hiding it in an implicit / dynamic system, but I'm not quite getting it as presented. Too bad.
- toadstone 15y agoSometimes articles are over my head too. Sometimes I work on figuring them out and learn something. Sometimes I give up because I don't have the time or energy. However, I don't blame the author for my ignorance.
- jdp23 15y agoIt's not blaming the author to notice that he doesn't appear very interested in this essay with communicating with most people in terms they'll understand. Sure, it's just his style, but it's hard to be optimistic about how much buy-in he'll get for his plan "to re-do the introductory curriculum in Computer Science to modernize it".
- happy4crazy 15y agoI guess I'm not disagreeing with you, but I personally find his style exhilarating. I mean, come on: Dijkstra used to say “beauty is our business”, to which I would add that life is too short, and bright minds too precious, to waste on ugly things. And if you take this point of view seriously, the best and the brightest are drawn to, rather than repulsed by, the field. Pace some of my colleagues at a Major Institute of Technology, students absolutely do love to program and do love the beauty of code, provided that the code you ask them to write is, in fact, beautiful. There is nothing more dreary than the corporate bureaucracy of OOP, and few things more lovely than the mathematical elegance of FP.
- mattmcknight 15y agoPerhaps I would find it more exhilarating if it didn't directly contradict my own experience, and that of many others.
- happy4crazy 15y agoI just have to say, I love Robert Harper's blog. He writes like I imagine Paul Graham would, if he were a slightly pedantic college professor--with crisp sentences that make points, dammit. His book on Standard ML is wonderful: http://www.cs.cmu.edu/~rwh/smlbook/book.pdf http://www.cs.cmu.edu/~rwh/smlbook/book.pdf
- jtregunna 15y agoI'm sorry, but there's something to be said for a good article. A good article isn't one whose first two sentences are flame bait. As such, I couldn't read the rest of the article.
- toadstone 15y agoI'm sure the author wouldn't mind especially if you copied the article into notepad and deleted the first two sentences before reading it.
- tomp 15y agoJudging by the first paragraph, the author has a very biased, even aggressive preference for static languages and a contempt for anyone that disagrees with him. I don't like that, and I find that the best and most convincing arguments are those that show understanding of the opposite side. People using aggression or logical fallacies in their arguments are usually the people who can't use logic to convince others. " ... types (static types, of course, there being no other kind) ... " This is the statement I'm referring to above. It strikes me as completely misguided and wrong. Most languages that I know of, even most statically typed languages, know dynamic types. Java has instanceof. C++ has virtual dispatch (which is based on an objects dynamic type). Even C (untagged) unions usually have some (bit)field that allows the running program distinguish the type of data in the union. I believe that in general, types are properties of data, which rarely exists at compile time. Thus, almost all types are dynamic. Statically typed languages simply restrict the data that can be stored in variables to a particular type and subtypes thereof.
- _delirium 15y agoHarper has somewhat... unorthodox views on the subject (and has had them for a long time). Here's the HN discussion of the essay he links to in that parenthetical: http://news.ycombinator.com/item?id=2346590 http://news.ycombinator.com/item?id=2346590. Quite a few also-prominent PLs researchers comment negatively in the comments on his post as well. In general I find Harper's "positive" opinions on the design of ML better than his "negative" opinions on why everything that isn't ML is doing it wrongwrongwrong, but he's definitely quite intelligent and usually has some good points.
- Darmani 15y agoThe author is not talking with the snide condescension of an Internet troll who, after reading the first chapter of a book, feels he's been clued into a grand truth. He's talking with the snide condescension of one of the world's top researchers in the field. Or, rather, he's not putting effort into communicating to people who don't have some background in PL theory and some familiarity with many of these arguments. Professor Harper typically spends two lectures in his undergraduate PL class developing the idea of dynamic typing, and then demolishing it. If you turn to the section on 'Static "Versus" Dynamic Typing' in his book (http://www.cs.cmu.edu/~rwh/plbook/book.pdf http://www.cs.cmu.edu/~rwh/plbook/book.pdf -- currently section 22.3, but subject to change), you'll find a summary of his argument. Basically, what dynamically-typed languages do is not really "type-checking" but "run-time tag checking." You brought up a really good point though -- C and Java aren't really statically-typed languages. Getting a null-pointer error is just not possible in a type-safe language.
- cageface 15y agoI've been reading eloquent advocacy of FP for over a decade now but significant real-world applications written in FP langs are still very thin on the ground. It's clear that FP languages are good research vehicles and teaching tools but the burden of proof of their general suitability lies squarely on the shoulders of the advocates at this point. Five years ago people were telling me Haskell was the greatest thing since sliced bread but now more often than not people discuss the tradeoffs of its design, much like most other languages.
- 6ren 15y agoHis linked article says of the popularity of dynamic language: "From what I can tell, it’s largely a matter of marketing.", that dynamic means fun, and that they are subversive. http://existentialtype.wordpress.com/2011/03/19/dynamic-languages-are-static-languages/ http://existentialtype.wordpress.com/2011/03/19/dynamic-lang... Dynamic languages are popular because you don't need to make decisions about types up-front, nor specify the types, nor change them when you change those decisions. In terms of the act of coding, it's more flexible when you begin, and more flexible when you maintain. He's right of course that static types are more flexible in terms of carving out a particular subset of the space of possible programs (as context free grammars are more flexible that regular expressions). That is, some simple and well-known facts are unknown to him. I still think he has something interesting to say, it just takes some extra work to get to it, and you have to take it with a grain of salt because although he's supremely confident, he's coming from quite a limited perspective. EDIT There's some hints in his conclusion and a comment that he does see real benefits to dynamic languages (without articulating them) - so perhaps he was just trolling or being ironic.
- chc 15y agoIt sounds to me like you're coming at the question without understanding all the facts either. Strong static typing doesn't mean you need to specify all your types. That's an orthogonal issue. There was actually a variant of Smalltalk, called Strongtalk, which turned it into a statically typed language but allowed existing Smalltalk programs to run unaltered.
- deleted 15y ago[deleted]
- 6ren 15y agoYes, that's part of static types carving out a subspace - just as context free grammars can represent any regular language. I was saying that, as a question of fact about the world today, one of the reasons that today's dynamic languages are popular is that you don't need to specify types (within the competitive set of mainstream statically typed languages). Not marketing. --- But maybe I see where he's coming from now: he's saying that statically typed languages are a superset of dynamic languages. So, therefore, they should be more popular than dynamic languages. But they're not... so, thinks he, it must be for some other reason... like marketing. This perspective would explain his attitude; but I deeply disagree with it. It's a mistake to expect popularity to measure technical quality. Sometimes they coincide, but not always. I don't agree with the common idea that "marketing" always causes the difference, as in promotion and advertising and advertising a technically inferior product leading to widespread adoption. I do think it is due to marketing, but not that kind. It's that the popularity of a product is due to how well it meets the needs of users, compared with the alternatives; it is not technical quality per se, but technical qualities that are needed. Needs are often ranked, in that users won't worry much about their second need until their first need is met. And after their first need is fully met, they don't really appreciate getting even more of whatever met it. Like being thirsty - a glass of water is great, two, maybe even a litre... but increase the amount enough, and pretty soon, you're just not that excited about drinking all that water. In other words, popularity is more about users than products - so it can be misleading to measure products by popularity. To bring it back to the article: the lack of mainstream popularity of his favourite languages is less to do with static vs. dynamic typing, and more to do with the reasons why lisp is not popular (e.g. libraries, familiarity, community, toolchain, intutiveness, etc). For example, abstraction is a great thing, but if it's more than a user needs to do the tasks they have in mind, then they start to judge it by other factors, like how easy it is to learn. If they absolutely need that level of abstraction, then they may go to the trouble of learning it - researchers and compiler writers (for example) sometimes need this; the mainstream simply doesn't. Of course, some people just love abstraction for itself, above all else - that's their first need. --- BTW: I can imagine a static/dynamic combination (like Strongtalk) taking off in the mainstream, provided it didn't get in the way. You just have to ask what needs it meets. One thought I've had is to have dynamic typing within modules, but static typing between modules (think: python with static types in library interfaces). I realize this is a subset in power of optional static typing; but I'm thinking more about the needs of users than the capabilities of technology. Interface documentation gets cleaner, bugs are found more easily; yet within modules, it's still easy to create code quickly and change it. It becomes harder to change interfaces (which are hard to change anyway, when other people depend on them). This is the use of it; the needs it meets.
- j_baker 15y agoUrgh... I love static typing and the type safety that languages like Haskell provide me. And I think they have practical benefit too. But I would give my right testicle if static typing advocates would stop encouraging the criticism that this is all academic nonsense.
- jganetsk 15y agoI agree with you, we need to frame this in an accessible way. The OP is one of the most eminent academics in the world on static typing. I've taken a class with him, and I learned a lot from him. His post can be rewritten in non-academic lingo. He is saying this: the module system in SML is better than any form of OOP out there. It solves the right problem in the right way. OOP conflates a lot of problems together and a lot of solutions together. And I think he's right, so let me start on a non-academic way to phrase this. SML modules require less programmer cognitive load, fewer lines of code, compile into tighter machine code, do not have the fragile base class problem, and can express complex relationships in a cleaner way.
- szany 15y agoI've always wondered why Haskell doesn't support named instances: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.87.6674&rep=rep1&type=pdf http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.87....
- jordohx 15y agoI'm sensing that we're on the verge of an SML renaissance. Over the last month I've been building web tools with SML and I have to say, that I'm moving faster than I ever have in any other language, when looking holistically at my project timeline. Dynamic languages give you the illusion that you're quickly developing, but when taking into account bug fixes that you have to exhaust hours of energy on after your product is deployed, they don't seem as "fun" and "free spirited" anymore. Loose(Dynamic) typing costs lives and billions of dollars. If you don't understand your data enough to describe the their types, then you should take a moment and sketch out your understanding. Otherwise, you're not developing quickly - you're spinning your wheels senselessly whether or not you believe it, and demonstrating that you're not the type of developer who has a deep understanding of the systems you build. Software engineering is not a bunch of sequential statements that happen to deliver results that we desire. Software engineering is artfully encoding your human understanding. But that being said, SML is insanely practical if you care about the results as much as you do about the design.