News for hackers. Stuff that matters.
Re:Summer of Programming Languages by tel on Monday July 07, 2014 @10:45AM (#7999111)
One of Harper's arguments (the author here) is dogmatic and perhaps compelling from a aesthetic point of view. Let me try not to butcher it too badly in what follows.

He believes a few things that in concert arrive at the idea that typed languages are the only interesting point in the design space thus uncovered.

He begins by first rigorously defining what he means by "type". In particular, it's a piece of information computed statically (i.e. using the syntax of a program alone, nothing of its "runtime") which constrains the eventual values the dynamics must take. A "type-safe" program is thus one where the dynamics correspond to the predictions of the statics—in particular, a program respects its type as it operates and the program "does not get stuck" i.e. does not hit an undefined state.

From here he notes the power of union types, types which are "either" A or B. Given a sufficiently large union type, one which reads "either this or that or this or that" for every possible result value of running a program then you can create a "safe" semantics for any language using this type—every program has this giant union type and every choice of dynamics ends up in this giant union type. He then notes that while this genuinely is "type safe" it's kind of boring. Further, all "dynamically typed" languages inherit this boringness since they expose no "interesting" static structure.

(Even if you dislike the argument above, and there's plenty that might cause someone to dislike it, it's worth noting that this line of thought arrives very smoothly at the concept of "hybrid typing" being explored by things like Typescript and Facebook's Hack.)

One of the primary things you could argue with at this point is that having more sophisticated types is interesting and valuable. To this end Harper focuses on what he calls the "Holy Trinity" of logic, type theory, and category theory. The idea is backed by the Curry-Howard-Lambek correspondence which shows that each of these fields is but an image of the other two. In Harper's (paraphrased) words: you know that something is genuine and lasting if you can show it exists in every branch of the Holy Trinity.

So he declares basically by fiat that things which reflect the Holy Trinity are interesting and things which do not are not. Obviously you can levy many arguments to disagree with him here.

But it's hard to declare that the things discovered in the Holy Trinity are boring. This is where cutting edge research on things like Homotopy Type Theory and general Dependent Types live. This produces compelling arguments to back up why "null pointers are a billion dollar mistake" [0] or why if-branching and booleans lack meaningful providence [1]. These ideas, even if they are stripped of their Ivory Tower gleam, are what are slowly percolating into mainstream languages with names like "Enum"++ in Swift and "Optional" in Java.

---

Generally, to finally provide my personal take, I think that Harper is dead right so long as you consider programming languages to be "means of expression". I think that's an interesting POV on languages generally and it's not totally at odds with the more everyday POV that languages are "tools for creation". But they are sometimes at odds since they place the brunt of what they demand of a language at different places. Ultimately, if Harper's program is successful many years from now we'll all use shadows of whatever futuristic grade of dependently typed language gives us maximal expressiveness while nesting it in an ecosystem of tooling and libraries which aid construction of interesting things. I have no idea if Harper's "one true language" exists, but it does seem like increasingly the world is moving that way... thus Harper's enthusiasm about Swift and Rust.

[0] http://qconlondon.com/london-2009/presentation/Null+Referenc...

[1] http://existentialtype.wordpress.com/2011/03/15/boolean-blin...

Re:Summer of Programming Languages by aidenn0 on Monday July 07, 2014 @02:11PM (#8000330)
Thank you for this very well written and thoughtful response. It definitely answers some of my questions. I tend to come at problems from empirical and intuitive angles, so arguments from first-principles tend to be lost on me.

This is likely because my first encounter with formal reasoning was in the field of classical philosophy, and many things I empirically knew to be wrong had been "proven" from first-principles in the literature.

Re:Summer of Programming Languages by freyrs3 on Monday July 07, 2014 @12:27PM (#7999626)
> Generally, to finally provide my personal take, I think that Harper is dead right so long as you consider programming languages to be "means of expression". I think that's an interesting POV on languages generally and it's not totally at odds with the more everyday POV that languages are "tools for creation".

That's a very concise way of putting it. My personal issue with a lot of what Harper writes is not that it's technically wrong per se, but it only makes sense if one is discussing programming languages purely from first principles. Harper seems really taken aback by the popularity of Haskell compared to SML in the functional programming space, and yet can't seem to wrap his head around the reason for the adoption is not so much about having ideal PL semantics but the fact Haskell has an industrial-strength cross-platform compiler with meaningful answers to modern problems ( FFI, concurrency, package management ). Haskell is rather unique in that it has a community that seems interested in building a language as both a "means of expression" and "tools for creation" and we've made some compromises between the two, no doubt. A lot of Harper's comments ( and many PL theorists ) seem to completely casually gloss over the gritty compiler engineering as if it's just beneath them, and that guys like SPJ and Simon Marlow are just wasting their time working on faster runtime systems and optimizations when he thinks they should be working on foundational "Holy Trinity" problems.

Re:Summer of Programming Languages by l_dopa on Monday July 07, 2014 @01:35PM (#8000068)
> A lot of Harper's comments ( and many PL theorists ) seem to completely casually gloss over the gritty compiler engineering as if it's just beneath them, and that guys like SPJ and Simon Marlow are just wasting their time working on faster runtime systems and optimizations when he thinks they should be working on foundational "Holy Trinity" problems.

That's a tempting view to take regarding theory vs. practice but I don't think it holds up when you consider Harper's whole body of work and the substance of his criticisms of Haskell: He has published extensively on ML implementation and, as far as I know, has offered criticism of (GHC) Haskell's type system where it is unsound, never the (really cool) work being done on the RTS.

Re:Summer of Programming Languages by freyrs3 on Monday July 07, 2014 @01:53PM (#8000187)
I've read his papers and I own his books, so I'm not entirely unfamiliar with his contributions to the field. But I also find his criticism of Haskell to be at best detached from reality and a "holistic" view of the programming profession as a union of theory, engineering, and community. Especially when he's arguing for the use of pure academic languages like Agda or antiquated ML-dialects that haven't seen active development in 15 years, over a productive language like Haskell. In an industry where regression languages like Go and Javascript are seeing wide adoption, I think his grandstanding does a lot more harm than good.
Re:Summer of Programming Languages by l_dopa on Monday July 07, 2014 @02:24PM (#8000433)
That makes sense. If you view Haskell as a research platform, pointing out ugly corners of the type system is entirely appropriate and even helpful for people working on GHC. From the outside, for those of us that would like to see these ideas gain greater adoption, it can be frustrating or even seem petty to focus on them.
Re:Summer of Programming Languages by freyrs3 on Monday July 07, 2014 @02:36PM (#8000508)
It is helpful and appropriate to point out bugs, and his comments did help fix the Typeable exception problem in GHC 7.8. But he doesn't go through the usual tracker and mailing list to report these things. He goes off and writes these angry blog posts and extrapolates small defects to justify sensationalist claims about the whole language. On one hand you have a respected PL researcher, on another you have a guy who is like the axe-grinding "Zed Shaw" of functional languages.
Re:Summer of Programming Languages by l_dopa on Monday July 07, 2014 @03:49PM (#8000956)
Yes, this is what compelled me to comment in the first place: based on what I've read of his blog, that comparison (and his reputation in general) seems completely unjustified. There's a world of difference between this kind of spirited but productive debate and content-free holy wars between roughly identical languages that get the spotlight in the "mainstream" tech blog circuit.

In fact, his post on exceptions in Haskell and his criticism of monadic IO led me to work on some alternatives (algebraic effects) which, oddly enough, helped me understand Haskell's approach at a deeper level. I wouldn't have known about the issue if it was only on the bug tracker.

Re:Summer of Programming Languages by tel on Monday July 07, 2014 @12:41PM (#7999716)
I'm always reminded there's a long-tail to research. It's sad that so much focus goes to the peak of that distribution, though. I think the tension between useless and useful is really important!