Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (492)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 2 3 [4] 5 6
  ignore  |  Print  
  JDK 8 is released  (Read 8280 times)
0 Members and 1 Guest are viewing this topic.
Offline gene9

Senior Member


Medals: 10



« Reply #90 - Posted 2014-03-23 20:10:45 »

..example why do C# and Java use a completely different syntax for arrays than for generics?
This is no comment on other syntax choices (what's important is self-consistence and not polluting the syntax) but from the perspective of Java:  a generic is a type bounds contract.  An array is limited pointer arithmetic.  These two features are completely unrelated.  So for a java like language it would be a bad choice to make them look similar.

Arrays can be thought of as pointer arithmetic and that's not wrong. In C/C++ the pointer arithmetic is more obvious and exposed. But it is also accurate to view an array as a data structure with a type bounds contract. And why should type bounds have different syntax and different casting rules?
Offline nsigma
« Reply #91 - Posted 2014-03-23 20:39:06 »

invokedynamic is cool, rest is a bunch of fluff. Disclaimer: I haven't looked at any of it because I don't really care. Lambdas are neat but don't make a big difference for me.

hmmm .. a) isn't invokeDynamic actually from Java 7?  b) so I presume you've missed the link between lambdas and invokeDynamic and the significant performance gains therefore over earlier options (ie. inner classes)?

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline Roquen
« Reply #92 - Posted 2014-03-24 09:00:14 »

..example why do C# and Java use a completely different syntax for arrays than for generics?
This is no comment on other syntax choices (what's important is self-consistence and not polluting the syntax) but from the perspective of Java:  a generic is a type bounds contract.  An array is limited pointer arithmetic.  These two features are completely unrelated.  So for a java like language it would be a bad choice to make them look similar.
Arrays can be thought of as pointer arithmetic and that's not wrong. In C/C++ the pointer arithmetic is more obvious and exposed. But it is also accurate to view an array as a data structure with a type bounds contract. And why should type bounds have different syntax and different casting rules?
Because you need to consider "syntax pollution".  Java the language has a number of desirable features which could added which actually are array related so consuming syntax space on a non-array feature makes no sense what-so-ever.  Examples include flattened multi-dimensional arrays, arrays 2.0 like features, flattened arrays of proper structures.  Don't know what happen to the java.util.Map array accessor overloading.

Oh while talking about non-fluff features.  Default methods.  All the focus has been on published API design & versioning, but it also make design by interface slightly less PITA since you no longer have to boiler-plate identical code in each base concrete (implementing) class.  Consider using (say) a circular doubly linked list as: design-by-{interface, composition, interface}.  As  long as some type 'T' need only be a member of one CDLL, design-by-interface now moves to be a pretty reasonable option.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Grunnt

JGO Wizard


Medals: 66
Projects: 8
Exp: 5 years


Complex != complicated


« Reply #93 - Posted 2014-03-24 09:09:05 »

Although I like the new features a lot (e.g. lambdas) I think these things are somewhat of a mixed blessing: one of the relative strengths of Java IMHO is that there generally are few different (although all verbose) ways of writing things down. This makes it a good language to "communicate" in as there are relatively few dialects (e.g. one programmer using feature X to express a solution, other programmer using feature Y). The more different ways are added to do basically the same, the more different "dialects" the language gets in practice, and the harder it gets to communicate in Java between developers. It may not be a huge issue, but something I'm pondering about.

Offline Roquen
« Reply #94 - Posted 2014-03-24 09:13:46 »

What's more interesting to you:  Java: "My first programming language" or Java: "Actually useful"?
Online Gibbo3771
« Reply #95 - Posted 2014-03-24 09:25:41 »

hmm, seems like Windows XP is not supported by Java 8 anymore (although some reports suggest it might still work there while other state various problems), about 30% of windows PC's still seem to be on XP which is still too high to ignore IMO.

If we kept making new things compatible with dead technology, cars would be pulled by horses. Let it die, stop feeding it. People need to upgrade or gtfo.

"This code works flawlessly first time and exactly how I wanted it"
Said no programmer ever
Offline gouessej
« Reply #96 - Posted 2014-03-24 09:49:22 »

If we kept making new things compatible with dead technology, cars would be pulled by horses. Let it die, stop feeding it. People need to upgrade or gtfo.
What about planned obsolescence? I'm not a fan of Microsoft Windows XP but I consider that its user base is large enough to go on taking care of it.

Offline Roquen
« Reply #97 - Posted 2014-03-24 10:08:37 »

It's a good thing I'm not the dictator of HotSpot releases.  I'd kill off the 32-bit VM as well.
Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #98 - Posted 2014-03-24 10:14:14 »

It's a good thing I'm not the dictator of HotSpot releases.  I'd kill off the 32-bit VM as well.
There's still a vast number of 32-bit devices out there though... like, most of them. Think ARM chips. For desktop implementations though... probably not such a bad idea, but give it another few years - still approximately 20% of my target (Steam) are on 32-bit machines, way too large to ignore.

Cas Smiley

Offline nsigma
« Reply #99 - Posted 2014-03-24 10:15:48 »

What about planned obsolescence? I'm not a fan of Microsoft Windows XP but I consider that its user base is large enough to go on taking care of it.

Planned obsolescence?  Windows XP has been through enough extensions of planned obsolescence (eeek, people are selling NetBooks with Linux on it  Wink ).  It officially dies in two weeks - why would any company wish to support it beyond that?  It's not even like Java 8 will be the recommended consumer release in anywhere near that time.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Roquen
« Reply #100 - Posted 2014-03-24 10:43:00 »

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!!!!!!
Offline Danny02
« Reply #101 - Posted 2014-03-24 10:56:26 »

Imagine if Java allowed coding in full UNICODE?

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!!
Offline Roquen
« Reply #102 - Posted 2014-03-24 12:50:55 »

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

Quote
Where library devs will include an actual lambda symbol(λ) in the public API
Sigh.  Like I always say...every feature you add past a non-macro assembler...somebody's gonna do something awful with it.
Offline Danny02
« Reply #103 - Posted 2014-03-24 14:08:41 »

Or do it in a generic elegant way like Scala  Wink

where there are some global desugaring rules which can be used by anyone and any class.

i.e.
1  
2  
3  
4  
var(a)  += b
//is rewritten to
var.update(a, var.apply(a).+(b))
//you can also use any method besides "+" which has the correct types

Offline Roquen
« Reply #104 - Posted 2014-03-24 14:44:32 »

LISP programmers always say: If you don't know LISP, you're doomed to try to reinvent it.
Offline BurntPizza
« Reply #105 - Posted 2014-03-24 14:47:36 »

LISP programmers always say: If you don't know LISP, you're doomed to try to reinvent it.

I've started with Clojure recently, my first reaction was pretty much "damn, why didn't I think of this?"
It's pretty nice.
Offline gene9

Senior Member


Medals: 10



« Reply #106 - Posted 2014-03-24 15:33:12 »

Arrays can be thought of as pointer arithmetic and that's not wrong. In C/C++ the pointer arithmetic is more obvious and exposed. But it is also accurate to view an array as a data structure with a type bounds contract. And why should type bounds have different syntax and different casting rules?
Because you need to consider "syntax pollution".  Java the language has a number of desirable features which could added which actually are array related so consuming syntax space on a non-array feature makes no sense what-so-ever.

I'm exactly considering "syntax pollution".

In Java you might have types: Path[], List<Path>, Map<String,Path>, ThreadLocal<String>, 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<Type> 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?
Offline Roquen
« Reply #107 - Posted 2014-03-24 15:43:25 »

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.
Offline gene9

Senior Member


Medals: 10



« Reply #108 - Posted 2014-03-24 22:57:16 »

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:

Scala is a giant mess of a language, and therefore unlikely to catch on.

You will see the elegance of it if you get into it. Java/C# are ugly hacks in comparison and you see many things that were fixed. I've listed the flaws before, but for example why do C# and Java use a completely different syntax for arrays than for generics? Legacy reasons. It's nice to see Scala fix that so arrays use generics and compile to the same byte code as Java arrays so there is no runtime difference.

princec, you never explained why you don't like Scala or what is wrong with it?
Offline Grunnt

JGO Wizard


Medals: 66
Projects: 8
Exp: 5 years


Complex != complicated


« Reply #109 - Posted 2014-03-25 07:35:23 »

Java is a turd. But it is my turd. I love this turd.

Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #110 - Posted 2014-03-25 09:58:56 »

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.

Cas Smiley

Offline Roquen
« Reply #111 - Posted 2014-03-25 10:24:57 »

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.
Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #112 - Posted 2014-03-25 10:38:59 »

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.

Cas Smiley

Offline Roquen
« Reply #113 - Posted 2014-03-25 14:02:48 »



1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
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; }
}
Offline gene9

Senior Member


Medals: 10



« Reply #114 - Posted 2014-03-25 15:16:30 »

I don't get why they haven't done multidimensional arrays yet.  It's trivial sugar.

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.

@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?"

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.

Offline gene9

Senior Member


Medals: 10



« Reply #115 - Posted 2014-03-25 15:26:06 »

I don't get why they haven't done multidimensional arrays yet.  It's trivial sugar.

From Oracle architect John Rose's Arrays 2.0 talk: http://cr.openjdk.java.net/~jrose/pres/201207-Arrays-2.pdf

"What Java coders say they want... Item #1: Rank > 1 (Fortran matrices, etc.)"

Read the slides. They clearly know what they are doing.

Offline BurntPizza
« Reply #116 - Posted 2014-03-25 15:27:41 »

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."

...
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.

If it's so simple then it should be in the JVM. That's what Roquen said. Nobody needs more boilerplate.

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.

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.

You guys are just content with Java syntax and haven't understood that stuff enough to appreciate the value.

That is a pretty damn confident assumption. Prepare your inbox.


I could show you and possibly convince you how it could be better in Scala.

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.

/rant

Please, let's get back on topic.
Offline gene9

Senior Member


Medals: 10



« Reply #117 - Posted 2014-03-25 15:51:02 »

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.

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.

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.

JVM architect John Rose has a pretty solid grasp on value types (aka structs): https://blogs.oracle.com/jrose/entry/value_types_in_the_vm

That's a likely feature for Java 9. VM also needs TCE (tail cail elimination) and Jigsaw which are obviously both planned for JVM 9.

Scala has native tuples and a very limited form of value types. Isn't that useful?
Offline Danny02
« Reply #118 - Posted 2014-03-25 16:39:06 »

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.
Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #119 - Posted 2014-03-25 16:55:14 »

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.
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?
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 Smiley

* 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.

Pages: 1 2 3 [4] 5 6
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Nickropheliac (16 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (33 views)
2014-08-22 19:31:30

atombrot (42 views)
2014-08-19 09:29:53

Tekkerue (41 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (26 views)
2014-08-16 06:20:21

Tekkerue (37 views)
2014-08-16 06:12:11

Rayexar (73 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!