WRT: 32-bit VM…die! die! die! Yeah I was only referring to desktop (and I was partly joking).
Come on chicken littles! Nothing to worry about here. Imagine if Java allowed coding in full UNICODE? Where would we be? Some people could use non-roman alphabets to code in and we couldn’t read it!!! Oh!!! Wait!! Ahhhhh!!!
Yep, as in Scala. Where library devs will include an actual lambda symbol(λ) in the public API , because who would need to be able to use the lib without IDE autocomplete anyways.
PS: I probably don’t get what you are saying with syntax pollution, but in my opinion the current C like array syntax is syntax pollution. One could handle arrays as any other Collection, with no special type outside of the normal type system. That arrays are special buildings blocks for the JVM would be just a implementation detail. Also array covariance has to die!!
WRT: Array/Containers: That’s higher level language reasoning which is reasonable (yuck! yuck!) for higher level languages. Java just ain’t a very high level language. Again there was talk of doing the opposite as sugar. For maps: map[“this”]=“that”. I don’t remember if they were thinking the same for sets, set[“foo”]=true
Sigh. Like I always say…every feature you add past a non-macro assembler…somebody’s gonna do something awful with it.
In Java you might have types: Path[], List, Map<String,Path>, ThreadLocal, etc.
Why does the first type need a completely distinct syntax from all other generics types with type parameters? It would be less “syntax pollution” to eliminated the legacy extra redundant syntax and just have one clean and consistent syntax.
Java can do ArrayList instead of Type[], but that introduces runtime concerns. However, those can be fixed as Scala does. Scala has Array[Int] and Array[String] compile down to JDK int[] and String[] so at runtime they behave identically.
Elimintating the Type[] syntax is unquestionably simpler and cleaner from source code syntax perspective. What is the potential loss in going to a identically performant Array[Type] syntax?
I think we’re look at different perspective. I’m thinking in terms of java: features were added in to order they were added vs. a possible syntax if all features were present from day 1.
I was explaining why Scala is great and Java is antiquated. I realize that Java can’t remove array syntax due to legacy and I already said exactly that in this thread. To quote myself from this thread:
princec, you never explained why you don’t like Scala or what is wrong with it?
It “fixes” a whole load of problems I just don’t have and breaks a whole load of things that I like. The syntax is wilfully different and more difficult to read. Allegedly the compiler is considerably slower too but the language itself makes me want to throttle my brain so badly I’ve never even got as far as wanting to install it.
What I want is Java, with blackjack, and hookers.
Failing that, Java, with structs/value types/mapped objects, ascii operator definition, and multidimensional arrays. Those three things will complete the language for me.
I don’t get why they haven’t done multidimensional arrays yet. It’s trivial sugar. (I will not write a compiler…I will not write a compiler).
@gene9 et al.: All this this syntax talk is just pure wankery on all of our parts. Really who cares? Java is internally consistent (OK mostly) and that’s just fine. Basically we’re discussing “use semicolons or not?” As a final note, things are slightly more complicated (on type bounds) than presented. Consider type-refinement in a java like language…say via self-referential types. And of course type bounds can be on an arbitrary number of types. A counter might be change the type system. Then we’re moving to a different realm of languages. And why do that if there’s an existing solution that scratches that itch? Like Cas, my major usability issues with java are all at the VM level.
Indeed, the only thing actually at the VM level that really needs addressing is the structs problem. That’ll solve most of my performance problems and complexity headaches at a stroke. I have a horrible feeling they’re going to come up with something outrageously esoteric and complex though. The great is the enemy of the good, etc.
import java.util.concurrent.ConcurrentHashMap;
public interface Evil
{
public static ConcurrentHashMap<Evil,Data> map = new ConcurrentHashMap<>();
static class Data
{
int whatever;
}
default Data getData() {
Data data = map.get(this);
if (data != null) return data;
data = map.putIfAbsent(this, new Data());
return data;
}
default int getWhatever() { return getData().whatever; }
default void setWhatever(int v) { getData().whatever = v; }
}
You can write your own mega simple wrapper class. There are almost zero limitations to that. I don’t see how this is holding anyone back at all.
The syntaxes advances over Java 7 are legitimately important. They definitely aren’t petty things like semicolons or not. You can write much cleaner, more concise, maintainable code with something like Scala.
You guys are just content with Java syntax and haven’t understood that stuff enough to appreciate the value.
Do you guys have any publically hosted code that you think is decent? I guarantee that if I could look at some mildly non-trivial code you guys write, I could show you and possibly convince you how it could be better in Scala.
I’m tired of this. This thread is supposed to be about the new JDK8 and the changes it brings. Not a Java v. Scala “debate.”
If it’s so simple then it should be in the JVM. That’s what Roquen said. Nobody needs more boilerplate.
Yes, let’s talk about that in this thread, instead of dismissively pointing at it saying “SEE, LOOK” to ‘prove’ a different inane off topic argument.
That is a pretty damn confident assumption. Prepare your inbox.
Please, can we stop with the Scala wanking? This is a Java forum. Neither side will sway the other.
I could start harping on about Clojure and how it’s better than both Java and Scala due to it’s nearly not having syntax, or whatever it is that the people who worship it care about, but I won’t, because it’s stupid.
Sure, the syntax is different, but that’s merely a learning curve issue. Almost every syntax change from Java is a good one. What does it break that you don’t like? Can you name specifics?
Types on the right and type inferencing are good things. Both C++ and C# added much more limited type inference but in C# for example type inference is limited to local variables and doesn’t work for class variables, static, or function return types like Scala.
Also, the compiler speed has mostly been fixed in recent versions of Scala especially with the official IDE and the “fast scala compiler”
Even Java 8 is a big improvement on eliminating a lot of manual iteration loop writing and temporary variables that Java <=7 requires.
I understand gene9 completely in the way that he is so enthusiastic about his favorite tool, but of course also the other side which is a bit annoyed about the derailing of this topic.
Let us just conclude that there is still many things which could make Java even better, slicker syntax or new JVM features.
And to give the syntax side of the discussion one more argument. Syntax like the try with resources is very needed, because it let us do the right thing without burden us with unnecessary boilerplate(having to close resource by hand in a safe way). For example a lazy keyword would be nice, because atm you need to have 10 LoC for each lazy field, if you want to do it correctly. The thing about other JVM languages is, that one doesn’t has to wait for the next mayor release for new better syntax. In Scala i can just write it myself.
I’m used to the C lexical style; I just want to keep it that way, then I don’t have to rewire any large portions of my brain or do any extra effort to mingle the two. I’ve got to the point where even syntax colouring is critically important for my productivity. So that’s what I want: extensions and refinements to the Java language, not A New Language. I don’t want to throw out all that brain* just for a couple of things that I’ve not hitherto really had much of a problem with anyway.
Cas
I am old, and busted, and cynical, and jaded. I’ve been programming now for 33 years. Quite frankly I’m sick of it. I’m especially sick of having the rug pulled out from underneath me. I like the slow pace of change in Java because it gives what’s left of my brain time to figure out how to use the changes.