The Next Big JVM Language
jroller.com
jroller.com
That seems ironic given the conclusion of the post. The reasons for rejection of Clojure and Scala are respectively "Clojure is too different fom Java", and "Scala is too powerful".
It's almost comical how well this encapsulates Blub programming (http://c2.com/cgi/wiki?BlubParadox ). or more to the point, assumptions about blub programmers by the author, who clearly at least understands programming languages.
The thing about this is, I don't see why we have to replace Java. The power of the JVM is that there need not be One True Language To Rule Them All.
Let people program in Clojure or Scala or JavaScript or Ruby. Design sensible interfaces for data interchange, and let people get on with their lives (and promote Polyglotism!).
Searching for the Next Big JVM Language is like searching for the next Facebook. Sure there are going to be new popular entrants, but the ecosystem is such that there will never be another Java, just the same way there won't be another Facebook.
Change is hard, and it challenges lazy thinking in blog posts like this.
Josh Bloch must be devastated.
"Code in static methods is inherently less reusable and accessible than code in objects."
I'm really not sure this is true. Since I've started programming in functional languages more I find myself using static methods more and more - my code seems to be perfectly reusable. I still use objects where they make sense, of course, but using singleton objects instead of static methods is insane.
The idea of a Java 3 (with corresponding new JVM) is an interesting one, though. It really shouldn't be that hard to create an automatic conversion tool since the semantics are formally specified. However I suspect that unlike what most Java programmers would like to think, most of the decisions around the Java language really aren't made with programmer comfort in mind - things like backwards compatibility and tool support have historically been much more important.
A lot of the problem here is branding. Schemes that are isomorphic with one another, and called singletons in one language and modules in another, are respectively reviled and lauded, sometimes by the same people.
Details:
If you need some "utility function" whose output depends exclusively on its arguments, you will be better of with an static method. However, this is a no fly for O-O-purists.
The option is to create a (possibly stateless) singleton class and put your non static method there. You will have the overhead of acquire the reference to the method in run time instead of compile time (and the few bytes needed to store the class and the ONE object reference).
On the other hand, singletons can be used to hold global state and the methods to legally change that global state. For this reason, they can be easily abused in order to bypass separation of concern rules and dress them in OOP-speak.
With respect to static methods: change your perspective. What's a module? You can look at it as a collection of named, statically typed definitions. Your static methods live here.
But what if you want first-class modules? To compose systems at the module level? Then you need a value of a module type, a way of passing these modules around and parameterizing modules by their dependencies. But we already have a mechanism that looks just like this: objects! So, let our modules be top-level singleton objects, and we get the best of both worlds.
For more along these lines, look at E (capability orientation, with objects representing capabilities) and Newspeak, Gilad Bracha's latest project. Eliminating the ambient authority implied by top-level static namespaces is key behind these (dynamic) systems. But similar approaches are not necessarily restricted only to dynamic systems.
That said, I'm a closet programming language geek so I'll check out your references, thanks for the pointers.
I think static methods are OK for the same reason that not every object needs to be an implementation of an abstract interface, but you should be aware of the possibilities you are eliminating when you make that choice.
I know it is bad form, but when I do still use Java for my own work, I have started making it look a bit like Ruby by using public instance variables (no getters/setters). Also, by not using checked exceptions and heavy use of generics I can keep code fairly concise.
Strong typing should be viewed as an optimization, either to optimize code's correctness or to optimize code's speed.
If you add CoffeeScript on top of that... whoa!
Just to be clear, this is what I mean when I talk about autocompletion (cursor is |):
def foo(bar):
bar.|
In order to complete on bar, you need to know the symbols available on the potential runtime values of bar. Everything can be in a system image, and you still don't know what gets through to foo() unless you either symbolically or actually evaluate the code and have a semantic breakpoint at the start of foo().As per your specific example, I think the reason SLIME works is because Common Lisp uses generic functions, instead of class methods. The calls are not Object.Method() rather Method(Object:Class) so Metho| always resolves.
However, I will grant you this: automatic class loading will easily trip up SLIME and similar tools.
Hmmm, I am gonna need to think about this further.
By reflection, I'm talking about interrogating runtime objects to see what's available on them. They need to be runtime objects because of monkeypatching and similar techniques. Because they're runtime objects, in some sense the code needs to be run in order to interrogate the objects. That execution may be symbolic, but that symbolic evaluation hits the halting problem, because it's normally a Turing-equivalent machine which determines how the objects will get constructed.
I'm not sure how usable it would be to have comments suddenly appearing -- it might get overwhelming if there are over 1000 comments, as on some Reddit articles -- but I think it could be pleasant on a smaller site like HN.
But from a hacker's point of view, Java is not expressive enough. Do we need to accept a dumber mainstream language for "the masses", or can we advance the state of the art by moving most developers to more expressive languages?
C# borrowed heavily at the beginning, seems like Java should return the favor.
* ease of adoption from existing Java developers because it's a superset of the java langauge
* the enterprise capability (which the author mistakenly dismissed it for) thanks to groovy++
* finally, if you were to change Java the way the author suggested for Java 8 and 9, then it would end up looking like Groovy anyway. So DRY and just adopt Groovy as the NBL and leave Java to be backwards compatible.
def method(a:'type,...) {}
def method(a:'type,...) = <expression>
def method(a:'type,...) : type = {}
Undoubtedly due to my ignorance and I do see the usefulness in each version but why so many ways? And the sugar that makes constructors so nice are a headache with tags and java library interop. I kinda prefer the F# middle ground on how it does constructors like that.And there are some other things to do with interop with Java - mainly varargs ive come up against tbh. I am sure I will have more trip ups as I learn. Otherwise I am very happy that a functional language like this exists on the JVM.
On the whole though, I'm finding Scala coding a very pleasant experience. A solid FP language on the JVM is turning out to be a very powerful tool.
But the alternative, of re-doing Java using the existing syntax with slightly different semantics, has serious dangers.
As an aside, are Perl and PHP in wide enough use to really support that 15% figure? Just curious - if I were making that list based on my own perceptions and experience I would leave those two and possibly COBOL off of it.
Is it just not exciting enough?