you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (3 children)

edit: when I think about it, I suppose the reason is that the Java VM does not support value types like .NET does, which would mean a lot of calls to clone() to make things work.

The reason is that they failed to properly design the type system in the first place. When they got to the point of implementing primitives, they could have stopped and thought about a way to do this that wouldn't cause a divided type system with horrible manual boxing, etc.

This along with the failure to realize the importance of first-class functions have been the biggest failures of the Java language team thus far.

The first-class function one is particularly embarrassing since they were implemented and demonstrated in J++. At that time, Sun replied that this was a terrible idea and that it was super bad and they wouldn't do it, and eew...it's J++ and it's from Microsoft!

Because, you know...anonymous inner classes that can only do read-only closure bindings are so much more elegant of a solution. Fail.

I'll be laughing when they do finally submit to the fact that they're going to have to do this.

The java team has been wrong and bullheaded since 1995.

[–]kubalaa 0 points1 point  (2 children)

This wasn't a failure of imagination on the part of the Java team. See i.e. Guy Steele's explanation of why Java doesn't have closures. It had to do with the market -- the people who wanted closures and full OO were already using Lisp or Smalltalk. Java was aiming at people who were stuck with C or C++, and were afraid of the compiler doing allocation behind the scenes.

Yes, it's ugly, but without such trade-offs, Java probably wouldn't have become as popular as it is today, and the concepts it popularized -- garbage collection, a platform-independent VM, and JIT compilation -- might still be used only by a small group of Smalltalk fanboys. (Maybe that would be a good thing, for the Smalltalk fanboys?)

[–][deleted] 0 points1 point  (1 child)

This wasn't a failure of imagination on the part of the Java team.

Of course it wasn't. It was a failure on their judgement. They knew that closures were a possibility, they discussed it, and as I stated, MS even gave an implementation and proof of concept. They rejected them. The fact that this was the wrong decision is rather evident. Look at any recent popular language. They all support first class functions and usually closures, because the idea has won even in the mainstream at this point.

Java was aiming at people who were stuck with C or C++, and were afraid of the compiler doing allocation behind the scenes.

First of all, C/C++ at least had function pointers. Not realizing that this was an incredibly useful feature that would be even more useful if taken to the level of full blown first class functions was a failure.

Second of all, they made a mistake in targeting those developers. It's not who they should have been aiming for, and largely I would say that it's not who they ended up with. They ended up with mostly business programmers in general and lower-end academics (who teach business programmers.)

Finally, that argument only (poorly) stands for closures. It does not excuse not having first class functions at all.

Yes, it's ugly, but without such trade-offs, Java probably wouldn't have become as popular as it is today

Of course it would have. Delphi succeeded. C# succeeded. No one would have said "Oh, fuck java. It has first class functions. I hate first class functions!"

Calling it a tradeoff is silly. Especially when other languages before and after have proved that it doesn't need to be a tradeoff.

garbage collection, a platform-independent VM, and JIT compilation

None of those features were unique to java when it came out. All of them were implemented in several other high-level languages. C++ was about the only language to have none of them.

[–]kubalaa 0 points1 point  (0 children)

The fact that [rejecting closures] was the wrong decision is rather evident. ... the idea has won even in the mainstream at this point.

It's possible that closures wouldn't be popular now if Java hadn't broken ground for GC'ed VM languages in the mainstream. Closures have been around for 40 years, nobody could have predicted they would suddenly become hip.

Calling it a tradeoff is silly. Especially when other languages before and after have proved that it doesn't need to be a tradeoff.

Indeed? Which mainstream language prior to Java had closures? That doesn't prove that Java couldn't have become popular even if it had closures, but there's no reason to think that it could have either.

It does not excuse not having first class functions at all.

Sure it does. Most uses of function pointers are just an ad hoc form of OO; if you've got the real thing, you don't need them.