Or C#'s var keyword, for that matter. Unfortunately, both will only work for local variables. I suspect this is one of the reasons there aren't any popular persistent data structure libraries around for these languages. At least the .NET/C# type system supports covariance/contravariance for functions ("delegates"). Plus, they managed to build F# on it.
To those wondering why not move to Clojure or Scala instead of this approach, here is why I am holding back:
a) I have a mission critical enterprise app that is in maintainance mode. I need to enhance certain features dealing with concurrency -- my team can ramp up Actor model implementation in functionaljava or Jetlang faster than they can ramp up on Scala.
b) No doubt that Scala is actually better Java , but I am confident that later versions of JDK would catch up. The concurrency features of JDK 7 are pretty good.
c) did I mention the team -- its hard enough finding a good java programmer; imagine how difficult it would be to hire good Scala programmers from the small eclectic community of Scala programmers.
d) most of the enterprisey stuff my team develops doesn't require functional programming -- just reliable applications delivered within drop dead deadlines. Plain old Java gets me there . JDK 7 concurrency and various Actor model implementations in Java such as FunctionalJava, Jetlang , Kilim are just cherry on top.
It would be actually easier to hire a good Scala than a good Java programmer because most Scala programmers are good. PG has an essay on this phenomenon somewhere.
I'm also not confident that Java will "catch up" to Scala. There's more to Scala than concurrency or functional programming. Type inference, first class objects, short syntax for FP, persistent datastructures, a better object system, etc.
> its hard enough finding a good java programmer; imagine how difficult it would be to hire good Scala programmers from the small eclectic community of Scala programmers.
It seems likely that it's hard to find good Java programmers precisely _because_ the skilled devs are tired of Java and see Scala as a way out.
I second Clojure for a functional programming language on the JVM. Why anyone would want to do functional programming in Java is really beyond my comprehension though.
[+] [-] srean|15 years ago|reply
[+] [-] timrobinson|15 years ago|reply
[+] [-] pmjordan|15 years ago|reply
[+] [-] stephen|15 years ago|reply
http://projectlombok.org/features/val.html
I find it frustrating that these guys can hack in "val" but JDK7 has token crap like the "diamond operator".
[+] [-] badmash69|15 years ago|reply
To those wondering why not move to Clojure or Scala instead of this approach, here is why I am holding back:
a) I have a mission critical enterprise app that is in maintainance mode. I need to enhance certain features dealing with concurrency -- my team can ramp up Actor model implementation in functionaljava or Jetlang faster than they can ramp up on Scala.
b) No doubt that Scala is actually better Java , but I am confident that later versions of JDK would catch up. The concurrency features of JDK 7 are pretty good.
c) did I mention the team -- its hard enough finding a good java programmer; imagine how difficult it would be to hire good Scala programmers from the small eclectic community of Scala programmers.
d) most of the enterprisey stuff my team develops doesn't require functional programming -- just reliable applications delivered within drop dead deadlines. Plain old Java gets me there . JDK 7 concurrency and various Actor model implementations in Java such as FunctionalJava, Jetlang , Kilim are just cherry on top.
[+] [-] joshhart|15 years ago|reply
I'm also not confident that Java will "catch up" to Scala. There's more to Scala than concurrency or functional programming. Type inference, first class objects, short syntax for FP, persistent datastructures, a better object system, etc.
[+] [-] technomancy|15 years ago|reply
It seems likely that it's hard to find good Java programmers precisely _because_ the skilled devs are tired of Java and see Scala as a way out.
[+] [-] jefffoster|15 years ago|reply
With the current situation with Oracle, Apache and Google I'm not entirely confident that the Java language will evolve in any significant way.
[+] [-] moondowner|15 years ago|reply
[+] [-] sp4rki|15 years ago|reply
[+] [-] srean|15 years ago|reply
[+] [-] sandGorgon|15 years ago|reply
It does have functional programming constructs though
Clojure is a much better candidate for FP on the JVM.
[+] [-] msutherl|15 years ago|reply
[+] [-] msutherl|15 years ago|reply
The main ones I could find were FC++ and FACT:
http://www.cc.gatech.edu/~yannis/fc++/ <http://hci.usask.ca/people/ragu/writings/FunctionalProgrammi...; http://www.fz-juelich.de/jsc/FACT/Old_Pages/fact_index.html http://www.boost.org/doc/libs/1_45_0/libs/functional/index.h... http://okmij.org/ftp/cpp-digest/Functional-Cpp.html or <http://www.haskell.org/haskellwiki/Calling_Haskell_from_C...; :)
[+] [-] srean|15 years ago|reply
http://sourceforge.net/projects/fcpp/
http://www.boost.org/doc/libs/1_45_0/doc/html/lambda.html
http://boost-spirit.com/dl_docs/phoenix-2/libs/spirit/phoeni...
[+] [-] mahmud|15 years ago|reply
[+] [-] shooll|15 years ago|reply
[deleted]