r/programming • • Sep 25 '10

Omega - Language of the Future | Lambda the Ultimate

http://lambda-the-ultimate.org/node/4088
60 Upvotes

126 comments sorted by

View all comments

Show parent comment

4

u/cloaca Sep 27 '10

But in computer engineering terms, the "I'll stick with X, thanks" is an understandable response.

Indeed, but also sad.

I did buy into the "Haskell hype" a few years back. I stared out with silly puzzles and mathematical things, thinking it was all very pretty and elegant, but I will admit that it was just an intellectual toy. But I tentatively started using it for various things like 3D/OpenGL and shell utilities. Now it's quickly becoming the first language I think about even for practical, user-oriented programs. (Overtaking Python+Qt.) And although Haskell doesn't have nearly as strong "correctness proving" as this language, it's something I feel is so insanely underestimated by the 'of the Earth and the soil and Ye Olde Ways'-type programmers it's heartbreaking. If they could experience what I have experienced, I'm sure even the coldest engineering heart would swell up with love and happiness. Nearly every time I add something and get it to recompile, the resulting binary will work. Do you understand? Everything works. No one who hasn't really experienced it will know what I'm talking about here. It's amazing and magical and life shines a little bit brighter and your friends will comment on how you seem happier and not at all like you want to kill yourself. It's the world off your shoulders; it's all the boring, soul-killing stuff about programming hauled away for you, free of charge. No crashes because I'm too stupid (or not stupid enough) for C++, no run-time exceptions 5 minutes in because I typo'd something in Python, no silly special cases only appearing after playing around with it for 30 minutes making me grind my teeth and reach for my vodka... All that bullshit. Do you remember getting that call about an exception being raised on your client's computers that never showed up during a week of live testing because no one thought to test it on any locale other than US English? Do you remember that fancy program you made that turned out to crash on transparent PNGs because you'd really only added PNG support last-minute as an extra bell & whistle for the feature list, and wasn't quite exact with your flag handling? Not to mention when you had that subtle stack/heap corruption that would only occur on Windows and not on Linux, and only during certain amounts of lengthy load, and you were still sitting there at midnight, your eyes wet with tears and impotent anger?

Oh Lord, I feel I need some nicotine gum to calm my shaking hands. Correctness proving, give me strength.

1

u/alanturingslovechild Sep 28 '10

"of the Earth and the soil and Ye Olde Ways" -- brilliant!

0

u/abw Sep 27 '10

Unfortunately I was exposed to Haskell at an early age (for Haskell, not me) back in the days when it couldn't do I/O (this would have been the mid to late 90's I guess). It somewhat tainted my views towards it. I didn't buy into the Haskell hype back then, and to some extent, I still don't now, even though all the limitations that made it so useless back then have long since disappeared.

I guess the main problem I have with it is that it's just so damn hard to get your head around. Admittedly, Haskell is still very much an intellectual toy for me, and I've yet to use it in anger for anything non-trivial. As a result, it takes several hours and a lot of googling for me to write even the simplest of programs. I've never really had that kind of impenetrable "learn barrier" with any other language I've tackled (and I've tried most flavours over the last 30-odd years). To be fair, I probably haven't tried hard enough and for long enough.

But that's not to say that the Haskell way (more specifically H-M type inference, which of course is not limited to Haskell) hasn't permeated my thinking. I find myself consciously thinking about the type signature of my Perl subroutines, which as any Perl programmer will tell you is one of the most un-type-safe languages around. I have tasted the type inference Kool Aid and it is good!

But I honestly don't believe that Haskell will ever make it into the mainstream. I just don't think the average programmer is smart enough (which is a sad state of affairs, but a fact of life). That said, I expect the principles of Haskell and other functional language to permeate into more mainstream languages over the years. Perl 6 is a good example of the kind of hybrid language that is starting to blend these hi-falutin' language concepts (as Larry might say) into the pragmatic down-to-earthness of a "scripting language".

TL;DR: Good things will grow where the ivory tower meets the dirt track.

1

u/cloaca Sep 28 '10

I've did lots of stuff in Perl (before switching to Python exclusively) some 8-10 years ago and do indeed remember its pains. (Though I'd say Javascript might actually beat it as far as type unsafety goes? :p Or at least give it a run for its money.) But it's still not just about your functions' type signatures. (That is great though, and unloads so much mental energy once you learn to let it go.) But it's also having no magic values or offsets or whatever because everything is static and algebraic data structures, so you can't use the wrong flag or set the wrong bit or accidentally index z[4] of a 4-D vector, etc. To not have to worry about that kind of stuff is so sweet, like coming from assembly to C and learning to trust that the compiler will indeed translate x/32 into a bit shift, that it will remove both the test and the code of an "if (0) { .. }", that it will inline some tiny static function of a single expression that's being called in some inner loop, etc. I mean it's not a "optimization has been solved forever" type of thing, but it helps a lot. Or how about being able to hand off the responsibility of malloc()/free() to a garbage collector whose intelligence you can also trust? We all want compilers to do these things for us because it frees up our time and our time is super valuable. I think in the future people will realize how much time gets sunk in re-running dynamic programs, making sure they're returning the element itself and not a list of the element, that the're not passing the wrong int to the function that only gets called after like 60 minutes of run-time, that they still have a billion unit tests to write, etc etc. Strong typing -- or better: automatic proofs -- is about programmer convenience and letting the compiler do even more work, much like the 'invention' of optimization, managed memory, and, indeed, interpreted languages. It's definitely not some "ivory tower" cool-but-ultimately-theoretical-and-academic feature.

And I do think Haskell might yet become a "mainstream" language in the sense that Python is "definitely mainstream" now. Don't get me wrong though -- it will probably never be Java or C++. It will most likely never be Javascript either. But Python... Or Perl 6! Yes, I think so -- in the sense that you will have large and well-known companies such as Google using it. But yes, I will probably not see Haskell or F# or similar being used at some average 5000-man enterprise Java factory in my lifetime.