News for hackers. Stuff that matters.
Re:Near Future of Programming Languages [pdf] by pron on Monday October 30, 2017 @09:28AM (#15584817)
> When your constraints mean that only the right thing can be done, you can make the thing implicit.

Except that sometimes, when you think about the practical issue long and hard enough, you can find that some constraints need not be stated at all, and can be completely factored out of the language, at least in most cases. For example, GC removes resource management out of the equation (it's not always the right solution, but it is the right one in a large enough portion of software). Or, while FP people pore over effect systems and how to constrain effect, languages like Eve that adopt synchronous programming (which is based on ideas from temporal logic), get a mathematical framework in which effects and computation are one and the same, and effects don't pose a challenge to begin with.

> I actually think that gradient ascent from Java will happen, and will move the industry forward

Perhaps, but I doubt it's in the direction pointed to by Idris. We have much better ideas around. The author of the slides mentioned only the segment of PL research that he find appealing. Other segments may have some more promising ideas.

> I think we can go at least one or two substantial steps better than Idris: I want Noether's levels of stratification (beyond just total/not-provably-total), and I want Rust-style linearity, not as a specialised capability but as something integrated into the regular type system. But even if Idris is the limit, it's still a big step ahead of Java, and it's going to take the industry a while to make that step.

I think you have fallen in love with a specific formalism (I've fallen in love with others) and can only see progress within it. If you take a step back, ignore formalism altogether and ask yourself -- or better yet, conduct research -- on what are the actual problems in programming, you may find solutions in completely different directions.

> it's still a big step ahead of Java

I don't think so, and I don't know why you'd think that. I'm not even sure that Java isn't the limit (modulo small improvements). Of course, when I say something is a big step ahead I don't mean that I enjoy it more or that it can pull some more technical tricks, but rather that it reduces development costs by 30%. If Idris is a big step ahead of Java, by how much do you think costs at, say, Google or Amazon or Citibank would drop if they decided they would all switch to Idris tomorrow? I'm fairly certain that it wouldn't be anywhere near 30%, and I'm not even sure costs wouldn't actually rise.

> it feels like most of the industry is only just adopting the things that OCaml offered, and not yet familiar enough with them to appreciate what Haskell offers above that.

I see it not as progress but as change in fashion. Tastes change, and so people adopt some ideas. Have productivity levels risen in the past three decades? Significantly less so than even Brooks's prediction, which was considered overly pessimistic.

Re:Near Future of Programming Languages [pdf] by lmm on Monday October 30, 2017 @11:31AM (#15585717)
> If you take a step back, ignore formalism altogether and ask yourself -- or better yet, conduct research -- on what are the actual problems in programming, you may find solutions in completely different directions.

It's hard to know what I don't know. I try to look at what people are doing/liking. But I feel confident that programming is inherently going to be about expressing the essence of the problem you're solving - a program will necessarily be as complex as the problem it's solving - and I think that limit is within reach of the approach I'm advocating, which is a conservative extrapolation of things we mostly already value. So I don't see the need to do anything more radical.

> If Idris is a big step ahead of Java, by how much do you think costs at, say, Google or Amazon or Citibank would drop if they decided they would all switch to Idris tomorrow? I'm fairly certain that it wouldn't be anywhere near 30%, and I'm not even sure costs wouldn't actually rise.

A lot of the value of better programming would be new opportunities, not just cutting costs. I think the industry switching to Idris-level languages will bring a factor of 10 to 100 improvement in productivity - i.e. I expect we'll see companies of ~100 people putting the Google/Amazon/Citibanks out of business, and companies of less than 10 people competing heavily with the giants. That's the sort of thing technological improvements enable - compare the rate at which new videogames are being produced now, and how small the teams producing them are, or look at WhatsApp being treated as a serious competitive threat to Facebook with a staff of 10. I think there's been a lot of productivity gain recently that isn't fully captured in economic measures, because we've (rightly) become a lot more quality-of-life focused culturally, and so our productivity has gone into quality-of-life improvements that aren't so visible in GDP terms.

But I fully expect the transition to take decades, with good reason - I agree that a large company switching tomorrow wouldn't reap much benefit from Idris (though I do think we're at the stage where a technologically-aggressive startup should consider it).

Re:Near Future of Programming Languages [pdf] by pron on Monday October 30, 2017 @12:14PM (#15586163)
> I don't see the need to do anything more radical.

I do, because the things that you mostly value (I guess I value them a lot less) seem to me incredibly complex for the good that they do, and we already have some alternatives that seem both more powerful and vastly simpler. But I am skeptical of them, too, though :)

> I think the industry switching to Idris-level languages will bring a factor of 10 to 100 improvement in productivity - i.e. I expect we'll see companies of ~100 people putting the Google/Amazon/Citibanks out of business, and companies of less than 10 people competing heavily with the giants.

That is a very powerful statement, and I'd like to know why you'd think that. I would even like to know what makes you think that any language (never mind which) can make such an impact, even though we've seen nothing of this sort. I do not share your belief that Idris could make such an impact or anywhere near it, nor probably any other language.

I am skeptical, because having looked at Idris and played with it a bit, I was completely underwhelmed. Java + JML can do pretty much the same, if not better, and for a lowe cost, and this is not a statement about Java+JML being a leap forward. I have no idea if Eve could make an impact as big as the one you predict, but at least I don't feel I can instinctively reject this possibility as easily as I could Idris, as Eve actually brings a lot of new things to the table, where Idris feels like some ergonomic improvement over things that may have had some potential that never materialized, in the hope that better ergonomics is what should do it.

I would like to point out one more problem with viewing the abundance of research as a proxy for utility or of an "established idea", one that touches on my own personal biases :) When you publish a paper, certainly in good journals/conferences, you must exhibit some significant novelty. This, ironically, rewards the more complicated (and so arguably less useful in the real world) frameworks and punishes the simpler ones. For example, I've seen papers talking about embedding separation logic, or specifying amortized worst-case complexity in Coq. You won't see such papers on TLA, because doing both in TLA is rather trivial. Lamport himself complained that he had trouble publishing a paper on specifying and verifying realtime systems in TLA because it is so straightforward that it was hard to demonstrate mathematical novelty. He had to artificially add an extra novelty (the use of a model checker) to make the paper worthy of publication [1].

[1]: http://lamport.azurewebsites.net/pubs/pubs.html#real-simple

Re:Near Future of Programming Languages [pdf] by lmm on Monday October 30, 2017 @01:07PM (#15586778)
> That is a very powerful statement, and I'd like to know why you'd think that. I would even like to know what makes you think that any language (never mind which) can make such an impact, even though we've seen nothing of this sort.

I think we have; I think we've seen dramatically accelerating programmer productivity. I think language improvements compound heavily: if a language is slightly more efficient in the small, that means code has to be broken up less, which give it more and more of an efficiency advantage as the codebase gets larger.

> I am skeptical, because having looked at Idris and played with it a bit, I was completely underwhelmed. Java + JML can do pretty much the same, if not better, and for a lowe cost, and this is not a statement about Java+JML being a leap forward. I have no idea if Eve could make an impact as big as the one you predict, but at least I don't feel I can instinctively reject this possibility as easily as I could Idris, as Eve actually brings a lot of new things to the table, where Idris feels like some ergonomic improvement over things that may have had some potential that never materialized, in the hope that better ergonomics is what should do it.

All of programming language design could be called ergonomic improvements. I always found all the pre/post contract stuff too complicated and too different from normal programming to get any value out of; being able to capture more in plain old functions, values and types is where I see value.

Re:Near Future of Programming Languages [pdf] by pron on Monday October 30, 2017 @02:10PM (#15587427)
> I think we've seen dramatically accelerating programmer productivity.

Really? I think that the change that has contributed to the lion's share of that boost has nothing to do with language features, and has everything to do with the availability of open-source libraries. The other major contributions have been the widespread adoption of automated unit tests -- also not a language feature, and the practicality of GCs -- if considered a language feature, it's a transparent one.

When Brooks said, around '85, I think, that we won't see a single improvement contributing to a 10x improvement within a single decade, people said he was pessimistic. After 30 years I don't think we've seen a 10x improvement with all methods combined, and if we have, most of it is due to libraries.

Do you think that writing, say, an ERP, a power-station control and management software or an air-traffic control system from scratch (without off-the-shelf/open-source libraries) today would be 10x less costly than it was using C++ in 1987, or even 3x less costly than using Java in 2002 (I'm taking 30 and 15 years respectively as milestones)? Remeber that 10x within a decade was seen as pessimistic.

Although I was just a novice programmer in 1987, I think that the answer to both is an emphatic no. Even when it comes to small/simple programs (which are a completely separate domain), I'm pretty sure that aside from the availability of libraries, Python doesn't have even a 3x factor over VB/Delphi/other "RAD" languages, as they were called way back when.

Re:Near Future of Programming Languages [pdf] by lmm on Tuesday October 31, 2017 @04:59AM (#15591814)
> Do you think that writing, say, an ERP, a power-station control and management software or an air-traffic control system from scratch (without off-the-shelf/open-source libraries) today would be 10x less costly than it was using C++ in 1987, or even 3x less costly than using Java in 2002 (I'm taking 30 and 15 years respectively as milestones)? Remeber that 10x within a decade was seen as pessimistic.

I'd want to amend that to no domain-specific libraries - I think part of the language advantage is making very general libraries possible. But yes, I do think writing such a system to the same standard would be better than 3x cheaper than in 2002. (I don't think that's what would be done - our implicit expectations around software usability are very different today to what they were in 2002. But I do think we'd get more than 3x better value for the same money than in 2002, certainly risk-adjusted - I think in 2002 there would have been a substantial chance that the project would fail outright)

For smaller programs I'd agree that we haven't improved that much, although it's very difficult to talk about how hard it would be to write small programs without libraries because small programs are mostly just using libraries.

Re:Near Future of Programming Languages [pdf] by boznz on Tuesday October 31, 2017 @02:05AM (#15591383)
Agree 100%
Re:Near Future of Programming Languages [pdf] by AnimalMuppet on Monday October 30, 2017 @01:32PM (#15587043)
> If Idris is a big step ahead of Java, by how much do you think costs at, say, Google or Amazon or Citibank would drop if they decided they would all switch to Idris tomorrow? I'm fairly certain that it wouldn't be anywhere near 30%, and I'm not even sure costs wouldn't actually rise.

How much would something like Idris lower costs at Experian? That is, in your "cost" metric, what weight do you assign to the cost of catastrophic bugs?

(Yes, I know, the Experian bug was in a third-party component that wasn't updated when it should have been. I assert that it's still a relevant question...)

Also note: I am not actually claiming that Idris would prevent catastrophic security bugs. But the question adds another axis where Idris could give you a 30% cost reduction.

Re:Near Future of Programming Languages [pdf] by pron on Monday October 30, 2017 @02:05PM (#15587379)
> How much would something like Idris lower costs at Experian? That is, in your "cost" metric, what weight do you assign to the cost of catastrophic bugs?

As a practitioner (and evangelist) of formal methods, you won't hear anything from me against the use of formal methods, although I have plenty of reason to believe that Idris (as an example of a particular design) is not very good at formal verification. The cost of bugs must be factored in, but we haven't seen the Idris approach effective at reducing bugs at a cost commensurate with their impact, except when their impact can be truly catastrophic. All the effective formal methods I know of look nothing like Idris.

As someone who has used formal methods to good effect (I believe) and is now learning Lean (which is can be put in roughly the same camp as Idris), I find it very interesting, but I cannot even imagine how it can form the basis for something that will one day be used at scale, especially given that there are such better alternatives.

Re:Near Future of Programming Languages [pdf] by noam87 on Monday October 30, 2017 @04:07PM (#15588424)
Pron, what are the better alternatives / more promising lines of research you keep referring to?
Re:Near Future of Programming Languages [pdf] by pron on Monday October 30, 2017 @04:37PM (#15588660)
I think they're better largely because I'm more aesthetically drawn to them (so I will be biased, but no more so than the author, who also only mentions techniques he's aesthetically drawn to), but also because I think they have shown more success in practical industry use.

For programming interactive systems, a very interesting approach which has been quite successful in realtime software and hardware systems, is synchronous programming[1]. It has a deep mathematical theory based on temporal logic, and has been shown successful both in terms of being amenable to particularly powerful forms of formal verification[2], as well as being useful for socially managing the development process[3]. The approach has mostly remained in the realm of safety-critical realtime, but has started making its way to "ordinary" software in languages such as Céu[4] and Eve[5]. Eve, in particular, incorporates at least as much cutting-edge PL research as Idris, but is very different from it, being based on a new and interesting language semantics called Dedalus[6].

In synchronous programming, side effects are not an issue, as the mathematical framework cleanly treats them the same as computation (not requiring embedding in monads), and so allows easy specification over both computation and effects, and a particularly easy way to express global correctness properties (e.g. [7]). The use of monads/algebraic effects in pure-FP is not substantially different from classical imperative programming, other than restricting the effect type, which doesn't seem to me to yield any substantial benefits in general. Using what is perhaps a very bad analogy, given the task of counting the number of passengers on a moving train, classical imperative programming would correspond to a person standing outside the train with a pair of binoculars, pure-FP would be like someone filming the train and then studying the film, and SP would be like someone standing inside the train. Rather than controlling what effects can be emitted by a piece of code, it controls at which point the passage of time can be observed.

In terms of formal methods, TLA+ [8] (a personal favorite of mine) has proven to be very effective, both in theory as well as industry practice -- perhaps more so than any other formal tool -- especially when it comes to specifying and verifying global correctness properties, such as "the database is always consistent", or "data is never lost, even if messages are dropped and nodes fail". It, too, is based on temporal logic, which is a theory that is much better suited, IMO, to interactive/concurrent/distributed software than the theory pure-FP, which is more harmonious with sequential, batch software like compilers. The difference in the difficulty of use of TLA+ vs a tool like Lean [13] for the purpose of software specification and verification (as opposed to doing formal "high math") is the difference between riding a bicycle and flying a Boeing 747.

As far as code-level formal methods are concerned, I find contract systems (like JML [9] for Java, and ACSL [10] for C/C++) to be more promising, again, in my personal opinion, than dependent types, because they separate specification from verification. This is important because while specification is always helpful, the chosen form of verification can make the whole difference between something that's more effective than testing and something that's completely infeasible. The most rigorous form of verification is formal proof, which is both the level of confidence least required by software and more or less the only form of verification afforded by dependent types, at least today. In contrast, contract systems allow you to verify your specification at a level of rigor of your choosing -- even on a per-contract basis -- be it formal proof, model checking or static analysis, concolic testing [11], random test generation [12], or even just inspection.

[1]: https://en.wikipedia.org/wiki/Synchronous_programming_langua...

[2]: https://en.wikipedia.org/wiki/Esterel

[3]: http://www.wisdom.weizmann.ac.il/~harel/papers/Statecharts.H...

[4]: http://www.ceu-lang.org/

[5]: http://witheve.com/philosophy/

[6]: https://www2.eecs.berkeley.edu/Pubs/TechRpts/2009/EECS-2009-...

[7]: http://witheve.com/philosophy/#correct

[8]: https://lamport.azurewebsites.net/tla/tla.html

[9]: http://www.openjml.org/

[10]: https://frama-c.com/acsl.html

[11]: https://en.wikipedia.org/wiki/Concolic_testing

[12]: https://clojure.org/guides/spec#_testing

[13]: https://leanprover.github.io/

Re:Near Future of Programming Languages [pdf] by noam87 on Monday October 30, 2017 @10:50PM (#15590790)
Eve looks interesting, thanks I'll try it out. (And the detailed response.)

Most of my programming is in the domain of "take some data, do stuff to it, produce an output" and my experience with Idris so far is very positive -- more so than Haskell (which I admittedly gave up on early on), the language does feel ergonomic, and like the type system is "guiding me" rather than getting in the way. I also find its approach to metaprogramming interesting. Whether this translates to Real World™ productivity / maintainability gains vs a mainstream language, it's too early for me to compare.

Re:Near Future of Programming Languages [pdf] by pron on Tuesday October 31, 2017 @04:29AM (#15591735)
BTW, to get a sense of how meticulous Eve's design process is (although I don't know if they'll ultimately be successful in their goal), take a look at this short post, explaining how they've recently decided to change the Eve UI after writing Eve's compiler in Eve (in the previous iteration it was written in Rust): https://groups.google.com/forum/#!msg/eve-talk/tLgrw4zlc5U/V...
Re:Near Future of Programming Languages [pdf] by pron on Tuesday October 31, 2017 @02:17AM (#15591415)
I don't doubt that Idris is a fine language or that some people will love it, even though personally I'm not drawn to pure-FP; I do doubt its revolutionary bottom-line impact.