I see that the proposed lambda expressions can omit type annotations on the parameters. Does that mean that Java 8 will have at least some limited form of type inference?
If they will be based on anonymous inner classes, then yes, they'll capture the variables from the surrounding scope. Those variables however will be 'final', which means that you can't re-assign them, even if their values are still liable to side-effects (e.g. setting fields, mutating collections, etc).
They are not based on anonymous inner classes (the implementation is likely to be much different) but they have the same restrictions as BDFFL_Xenu described.
Two things: this is one of the trolliest posts I have seen on HN on a while, save for my own (now deleted) counter-troll. The fact that it keeps getting upvoted is astounding. Seriously, associating a certain technique with uber geeks/neckbeards/nerds is actually a valid argument for discounting it?
It's true that FP is presented too often as a remedy for the common ailment of programming of not producing software that you can understand quickly enough. Also known as 'productivity'. But just because it's over-enthusiastically promoted it doesn't mean there's no truth to the claims. It's mostly that
a. you can compose your software nicely from parameterizable operations over common structures (map, reduce, filter, take, etc.)
b. mutable state can make programs messy so you should avoid it
But of course you don't care. At all. After all, if you did, you wouldn't be quickly hand waiving the whole issue with a fleeting reference to 'recursion', as if it was the dominant instrument in functional programming. You learn _very_ early that writing recursive functions is just more work than throwing together a bunch of functions over a sequence or some such if needed.
So that's the justification? That the GIMP expects WM settings that were only the default on TWM and the like over 15 years ago?
Well, I must say that I haven't seen any other application of its size take the "NO WARRANTY" shouting of the GPL so seriously.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
But the program did start as a showcase for some graphics manipulation algorithms that the authors made. Maybe the fault is with the people with the high hopes that it was actually meant for them to use and edit their photos.
PHP is academic?! What definition of academic could you possibly be using?! The blasted thing doesn't even respect basic things like transitivity in its most commonly used equality operator, its author says that he hated programming and didn't know how to write a parser when he first implemented it. And the thing as far as I know doesn't have a specified grammar. It just disregards as much of the body of knowledge of computing as it can while still actually running on a computer.
If anything, C has a much more academic pedigree, being born in an industrial research lab and having /gasp/ an specification.
Awesome! But actually I think my comment was inadvertently a bit more illuminating than the SICP exercise :-) Despite being on the web, SICP is a "traditional" textbook and doesn't bother to link to Wikipedia. Instead they use some sort of stone-age technology called "footnotes", stuffing all supplementary material right into the book as a couple lines of tiny text. So the student gets the feeling of following a twisty cluttered rabbit hole instead of exploring a new land.
Well, SICP was a printed book before being put on the web (as it is quite a few years older than it), and the version you see on the webpage is just a rendition of it in HTML. Still, I didn't know until today that you could link to individual figures and exercises, it will be even more fun to cite it in a quasi-religious, trollish way.
Also, you generalized the principle (and fused two exercises of the book in one :), or at least I'll have to believe you ;) I didn't form really much of an intuition on eigenvectors during the completely proper Linear Algebra course that I took, which is only my fault.
But I think that the exercise serves to reinforce the underlying theme that with enough attention, one can either supply or draw the insight to chip away yet one more part of the problem, to attack it from another angle, to pull it from just another direction that one had not seen before. It celebrates cleverness and knowledge, used to make complex things simple, to find the easy way out the hard way and end up better in the end, and that's partly why it's so cherished, but we all know that.
> Instead they use some sort of stone-age technology called "footnotes", stuffing all supplementary material right into the book as a couple lines of tiny text.
A bit OT.
I got tired of clicking on the footnote links, and click to come back to text, and wrote a little Greasemonkey script that shows the footnotes on mouse hover. Makes reading the text a bit easier.
> And if you can't read code well, go practice some more.
Actually, let's not. To paraphrase a minor celebrity of programming, life is too long to be good at reading every variation of boilerplate. Java is essentially hostile to small functions and parametrization, as having any semblance of inner or anonymous functions will require you to define a class at least, or an interface somewhere else, scattering your code unnecessarily, and you'll probably just end up repeating the code because it's just not worth the effort to do it. Don't believe me? Why do you always have to .open() and .close() your any port-like thing manually? That's a solved problem, you know?
> To paraphrase a minor celebrity of programming, life is too long to be good at reading every variation of boilerplate.
Learning to read code is just like learning to read English. You can guess most of the words meaning once you know some of them. Personally, I think being able to read code is the best skill you can have as a programmer. Just as a good musician is able to listen to music properly. (I mean 'listen' as in analyze, understand, notate and copy).
The other point IMHO is that scattering your code with anonymous functions points to bad design and is as bad as scattering "GOTO" everywhere in BASIC code. It leads to spaghetti code which is an unmaintainable mess.
> Learning to read code is just like learning to read English. You can guess most of the words meaning once you know some of them. Personally, I think being able to read code is the best skill you can have as a programmer. Just as a good musician is able to listen to music properly. (I mean 'listen' as in analyze, understand, notate and copy).
Yes, that's very true, but it's also a red herring. Not all code is worth to read, nor is it worth to write. Certainly not either the copy+pasted mess that would result of not using first-class functions, or all the _noise_ introduced by their half assed expression using classes.
> The other point IMHO is that scattering your code with anonymous functions points to bad design and is as bad as scattering "GOTO" everywhere in BASIC code. It leads to spaghetti code which is an unmaintainable mess.
Spaghetti? Really? As in flow of control? You _really_ don't know what you are talking about. Sure, it does enable some trickery, like Continuation Passing Style, but if you are arguing that such a technique is a 'con' for the existence of what amounts to just both functions and lexical scope, you are grasping straws.
On the other hand, you have simple abstractions that are enabled by first-class functions, like map or the folds, and you won't have to hear of silliness like the 'Command Pattern' or the 'Strategy Pattern' to work around the restrictions that make them necessary. And the subsequent explosion in code, to be found later shoved in other classes and packages. They make dispatch tables easy, they give you a simple way to make asynchronous code, they allow wrappers for guarded code, they...
Do yourself a favour and take a good look to the first two chapters of SICP (http://mitpress.mit.edu/sicp/), most of their charm is displayed there.
It is a good question to ask though, as there are societal pressures against men going into any profession related to children (e.g. the pedophile scare). But asking it _here_ is just cheap whataboutery to silence the discussion.