News for hackers. Stuff that matters.
Re:Under the Hood with Java 10 Enhanced Generics by eropple on Monday December 29, 2014 @05:56PM (#8812283)
This is really troubling to me. I'm a Scala developer and JVM nerd by trade (though more devops and high-level architecture as of late) and I've been hoping really hard that they'd just bite the bullet, flag-day the current type erasure and non-unified type system, and make Java 10 what...well, what the CLR is, now, today. The generic specialization route they describe is at best gross, isn't much better than what Scala already does today, and kicks the real problems only slightly further down the road.

Still being crap in 2017, when the alternatives are good to great now, is dangerous, and Oracle's fear of alienating the masses of people who'll forever be two versions of Java behind is leaving the door open for Microsoft. I write games in C# in my free time, and between how great VS/R# is[1] and Microsoft supporting a CLR implementation I am inclined to trust more than Mono's on Linux and OS X, I'm excited at the prospect of being able to use .NET for server applications (no, no Windows Server for me, not now and not never) in the future.

[1] - IntelliJ comes close, but it does suffer, from a usability standpoint, from being cross-platform and having to compromise--I'd rather run a VM on my Mac to use VS than use IntelliJ, all things considered!

Re:Under the Hood with Java 10 Enhanced Generics by chvid on Monday December 29, 2014 @09:18PM (#8812973)
I think a lot of people would see things differently.

.NET is much less a threat to Java today than it were 10 years ago. Today Windows is no longer the dominant platform, you have Scala for people wanting more advanced language features, you have Android and web applications are in general preferred over desktop applications. And if you are writing desktop applications then you need to take into account the Mac platform where .NET is at best a second class citizen.

And when it comes to IDE: I find IntelliJ far better than VS from nearly every standpoint - I simply don't understand your last remark.

Re:Under the Hood with Java 10 Enhanced Generics by bigdubs on Monday December 29, 2014 @09:52PM (#8813069)
As far as .Net's future as illustrated, Android is not the preferred target for most mobile developers; iOS is, and currently the best cross platform runtime is based on mono/.net. Time will tell if cross platform server software programming catches on (my hunch is that it will with more mature frameworks). Kestrel and .net core 5 are a huge assault on java on the server, and warrant attention from oracle.

As far as the IDE's, I've used both and can say that I vastly prefer Visual Studio paired with ReSharper (the R# in the previous comment). This is the first comment I've seen in a public forum, actually, that says that VS is not better than IntelliJ.

Re:Under the Hood with Java 10 Enhanced Generics by kasey_junk on Monday December 29, 2014 @10:41PM (#8813207)
Count me also in the camp of someone who has never heard a person choose Intellij over VS with Resharper who has used both for any significant time.

As for .NET, if it were a viable Linux server side VM, C# would be a very compelling language in comparison to any of the JVM languages. It blows Java out of the water, and even as a full time Scala developer, I'd have a hard time arguing against it vs Scala because the things I love about Scala come with so many things I hate.

Re:Under the Hood with Java 10 Enhanced Generics by chvid on Tuesday December 30, 2014 @02:00AM (#8813646)
Heh. I guess with the IDE's there is quite a bit of personal taste involved but believe me I am not the only who prefers IntelliJ.

Wrt. the other things; the way I see it .NET-support outside Windows has been "vapourware" since .NET's inception. It simply has not happened. In the beginning I thought this was MS's deliberate strategy but now the tables have turned and as a sinister business strategy it does not make sense anymore.

I have no more love for Oracle than I have for MS and I would love to see something as solid, cross-platform and performant as the JVM from MS but it just is not there.

Re:Under the Hood with Java 10 Enhanced Generics by eropple on Tuesday December 30, 2014 @02:09AM (#8813662)
Cross-platform and performant? Wait six months. (My friends in a position to know say sooner, but I'm a pessimist.)
Re:Under the Hood with Java 10 Enhanced Generics by chvid on Tuesday December 30, 2014 @03:33AM (#8813814)
Ok. I have been waiting since 2002 so what is another 6 months? :-)
Re:Under the Hood with Java 10 Enhanced Generics by bigdubs on Tuesday December 30, 2014 @09:03AM (#8814597)
https://github.com/aspnet/KestrelHttpServer

don't need to wait much longer; it's already faster than nodejs for trivial benchmarks and getting better every day.

Re:Under the Hood with Java 10 Enhanced Generics by caoilte on Monday December 29, 2014 @07:32PM (#8812656)
There are a lot of problems with reification. It's a real strait-jacket. It would kill the JVM as a platform for Clojure and Ruby and kill some of the advanced parts of Scala.
Re:Under the Hood with Java 10 Enhanced Generics by sanderjd on Monday December 29, 2014 @07:35PM (#8812680)
Interesting! Could you expand on that or direct me to some good links on the subject?
Re:Under the Hood with Java 10 Enhanced Generics by papauschek on Tuesday December 30, 2014 @08:17AM (#8814443)
I talked with Vlad Ureche (from the EPFL Scala Team) about this very topic a few months ago after Scala Days Berlin. He said that some Scala features would not be possible to implement on the CLR because of its restrictive generics implementation. So while JVMs generics type erasure is a pain, it seems to give more room for innovation on the language level.

Unfortunately I did not understand the specific reasons he gave, but it had to do something with reification.

Re:Under the Hood with Java 10 Enhanced Generics by eropple on Monday December 29, 2014 @08:56PM (#8812914)
I'd be interested in what parts of Scala that an intelligent implementation of reification would harm.
Re:Under the Hood with Java 10 Enhanced Generics by lmm on Monday December 29, 2014 @04:38PM (#8811940)
If you can't wait until 2018, it's worth pointing out that Scala has production-quality implementations of these features on the JVM already, usable today. There are plenty of nontrivial limitations (that will cause a traditional boxed codepath instead), but the core features are working.
Re:Under the Hood with Java 10 Enhanced Generics by lukedegruchy on Monday December 29, 2014 @05:57PM (#8812284)
Scala isn't the only alternative JVM language that has a superior generics implementation and that doesn't have primitives.

What neither Scala nor those languages have is support for value types (structs) at the JVM level. Generics over primitives and value types is a natural consequence of the introduction of value types to the JVM.

Re:Under the Hood with Java 10 Enhanced Generics by pkinsky on Tuesday December 30, 2014 @10:51AM (#8815036)
Re:Under the Hood with Java 10 Enhanced Generics by hyperpape on Tuesday December 30, 2014 @11:35AM (#8815263)
The document says that you can't actually always avoid the Object allocations, because of the JVM. I'm pretty sure you'll need VM changes in addition to language changes for this.
Re:Under the Hood with Java 10 Enhanced Generics by rational-future on Monday December 29, 2014 @05:42PM (#8812227)
Yeah, but then it has also around 10K other features, most of which you don't need. Most Java developers won't be able to become Scala masters by 2018 anyway, if at all.

On the other hand C# has even better generics than this proposal, along with await, dynamic, yield. And it's now supported by MS and Xamarin on all big platforms.

Re:Under the Hood with Java 10 Enhanced Generics by eropple on Monday December 29, 2014 @06:19PM (#8812368)
I like C#, I write a lot of it, but the claims of complexity regarding Scala are just so vastly overblown. Anyone who's a competent Java programmer and has an open mind (which is the nicest way I can think of to say "doesn't pee themselves when they see a lambda") can be a competent Scala programmer within a month of daily use. It's not that hard, the tooling today in IDEA is roughly Java-level in terms of quality, and the language itself steers you towards constructs that make doing the Right Thing fairly easy.
Re:Under the Hood with Java 10 Enhanced Generics by the_af on Monday December 29, 2014 @08:00PM (#8812755)
I like Scala (and I'm starting to use it in my day job!) but I don't really think IDEA tooling is "roughly Java-level" quality. In fact, all the Scala IDEs I've tried are astonishingly bad, IntelliJ included.

The consensus among the more knowledgeable Scala programmers at my office is that IntelliJ is too quirky as an IDE (probably due to its built-in Scala compiler which gives way too many faux compile errors. This is maddening in a statically checked language!), and Eclipse-based Scala IDE is only slightly better. They recommend entirely disabling incremental compilation in the IDE, and instead using SBT for this. Coincidentally, this is what someone here on HN told me is the "unofficial recommendation" from the Typesafe guys -- I wouldn't know. As another example of broken tools, with Scala IDE refactoring is so fundamentally broken I cannot use it; it often results in wrong code (with Kepler-based Scala IDE, I've tried refactoring the name of a method and it resulted in syntax errors in other files!). Debugging is also hit-and-miss, at least with Scala IDE.

This is miles away from most Java IDEs, which are perfect in this regard. Not having compile errors correctly reported as you type is truly disappointing. Not being able to reliable refactor or debug code is very frustrating.

(I realize this is a tooling problem, and I love Scala. I'm just puzzled that almost nobody seems to consider these issues as disappointing as I do).

Re:Under the Hood with Java 10 Enhanced Generics by lmm on Tuesday December 30, 2014 @03:16AM (#8813783)
I won't touch IntelliJ, but I find Eclipse good enough to work with. I've seen the syntax-errors-in-random-files bug occasionally; it's always been a block of text "moved" to the wrong place in the file. Annoying and worrying, but pretty quick to fix. Debugging has always been reliable though, and simpler refactoring works, and it's getting better at a good rate. But yeah, the problems are real.
Re:Under the Hood with Java 10 Enhanced Generics by the_af on Tuesday December 30, 2014 @10:43AM (#8814997)
It's interesting that debugging is reliable in your setup. I use Kepler-based Scala IDE, and debugging sometimes doesn't work, which means: not all expressions are inspectable. Sometimes you cannot inspect the value of a variable. I'm beginning to think this is actually a Scala issue: maybe those expressions simply get elided in the actual bytecode?
Re:Under the Hood with Java 10 Enhanced Generics by lmm on Tuesday December 30, 2014 @11:20AM (#8815178)
It's possible; I tend to only look at member variables. Note that if you're inside a block then variables from a slightly larger scope are often under this/this$2 or similar. Are you using the old scala debugger or the new one? (I'm using Luna now, which didn't give me the choice, so presumably the new one is stable enough that they've made it the default?)
Re:Under the Hood with Java 10 Enhanced Generics by eropple on Monday December 29, 2014 @08:13PM (#8812795)
Maybe you're using different Java knobs than I am, but IDEA 13 (haven't bought 14 yet) is effectively the same for me between Java and Scala. The Scala environment is perceptibly slower if I pay attention to it, but not that much and is generally unnoticeable. I can't remember the last time I had a bogus compiler error.

The only thing I can think of is that I only use imported SBT or Maven projects. Maybe that has something to do with it?

Re:Under the Hood with Java 10 Enhanced Generics by timv on Monday December 29, 2014 @10:01PM (#8813091)
My experience is much more like the one described by the_af .

IntelliJ is OK for most Scala code, but it regularly makes a mess of anything complicated. So much so that, in our office, the first answer to "why doesn't this code compile" is "Does it really not compile, or is IntelliJ being dumb again?" It's usually the latter.

I think it depends on what style of Scala you use. Anything involving slick or spray tends to confuse IntelliJ. Its better in 14, but it's still not good.

The refactoring is bad enough that I hardly ever bother using it. It gets simple things mostly right, but doing that by hand is just as easy. It can't do the more useful things like method signature changes.

The tooling support for Scala is improving, but its at about 10 years behind Java tooling.

Re:Under the Hood with Java 10 Enhanced Generics by eropple on Tuesday December 30, 2014 @02:06AM (#8813658)
Huh, I use Slick quite a lot and never have trouble. Never used Spray. I guess I don't write terribly complex stuff (I really do use Scala largely as I'd use a JVM C#, I suppose) in general, though.

About all I find myself using refactoring tools with for Java is renaming, honestly, so I guess I'm more likely to have my itches scratched by the current state of tooling.

Thanks for the explanation, though!

Re:Under the Hood with Java 10 Enhanced Generics by the_af on Tuesday December 30, 2014 @10:40AM (#8814977)
I don't write complex Scala code either. Simple renaming doesn't reliably work for me on Kepler-based Scala IDE for Ubuntu :( This means sometimes it will fail to rename in every call site, and sometimes it will introduce random symbols.
Re:Under the Hood with Java 10 Enhanced Generics by eropple on Tuesday December 30, 2014 @01:25PM (#8815853)
I've never found ScalaIDE worth the time of day--I wrote Scala in Vim before IDEA 11. There, simple renames work fine. =)
Re:Under the Hood with Java 10 Enhanced Generics by kasey_junk on Monday December 29, 2014 @10:57PM (#8813238)
I'd suggest that there are lots of people who consider these issues as disappointing as you do, they just don't intersect very well with people who continue to program Scala.

Every day I find myself asking if the language is worth the terrible tooling story, and so far the language keeps winning out. But I completely understand people who don't come down on the same side as I do on this issue.

Re:Under the Hood with Java 10 Enhanced Generics by lukedegruchy on Monday December 29, 2014 @06:24PM (#8812389)
I disagree. I think Scala suffers from Perlisms like being too succinct and more than one way of doing things (ex omitting dots and parens to invoke a method). There are newer alternative JVM languages that are more consistent and preferable to Java, so I disagree with your argument that those of us that prefer not to use Scala are Luddites.
Re:Under the Hood with Java 10 Enhanced Generics by eropple on Monday December 29, 2014 @06:35PM (#8812447)
Meh? B&D languages bother me, for the most part--your criticisms would apply to C++, which I'm also happy to use. I mean, omitting dots and parens is primarily of value in flexible DSLs. Otherwise? Talk like adults and figure out the idioms you wish you adopt. Does one of your developers do something that you don't like. Then y'all talk it out. Not hard.

Consistency is important, but effectiveness is, by my lights, moreso. Java's biggest problem isn't the language, which is sad, but its type system, and I've yet to see a newer alternative JVM language with a type system remotely worth discussing. (Which isn't to say it doesn't exist, but it sure isn't Ceylon or Kotlin.)

Re:Under the Hood with Java 10 Enhanced Generics by lukedegruchy on Monday December 29, 2014 @09:09PM (#8812944)
What's wrong with Ceylon's type system? I find it incredibly well designed. For instance, the Ceylon compiler won't allow you to assign null to a non-optional variable. Also, there is a bottom type, which makes controvariance far more manageable. I could go on.
Re:Under the Hood with Java 10 Enhanced Generics by jbooth on Monday December 29, 2014 @09:18PM (#8812972)
"Talking it out" isn't an option when you're dealing with code that's older than last week, let alone code written by developers that you've never met - you can't talk it out retroactively. That's a huge part of the 'which effective subset' argument against C++ and Scala. The argument is that, in the long term, 'simplicity and consistency', even if clunky at times, are way more effective than 'expressiveness'.
Re:Under the Hood with Java 10 Enhanced Generics by lmm on Tuesday December 30, 2014 @03:27AM (#8813803)
> "Talking it out" isn't an option when you're dealing with code that's older than last week, let alone code written by developers that you've never met - you can't talk it out retroactively.

Omitting dots and parens is so superficial that you could change the code purely mechanically to your preferred style. Just like running an autoformatter on someone's code before reading it because you don't like their indentation style.

Re:Under the Hood with Java 10 Enhanced Generics by lmm on Monday December 29, 2014 @07:20PM (#8812611)
Omitting dots and parens is superficial; it's no more a Perlism than allowing whitespace or extra parens (which almost all languages do).

Could you give an example of what you consider a more consistent JVM language? I find Scala is often more consistent, because it uses a small number of powerful features. E.g. Kotlin doesn't have Scala's implicits - so it instead has a bunch of different special-case features (e.g. extension methods) to replicate their use cases.

Re:Under the Hood with Java 10 Enhanced Generics by lukedegruchy on Monday December 29, 2014 @09:05PM (#8812937)
I disagree about the dots and parents. It impacts readability because the person reading the code, which most developers do 90% to 95%. If different developers on the team use different styles, it makes reasoning about the cod that much more difficult.

I can't say I've followed Kotlin all that closely, but it struck me as a less dense language. Ceylon is a language I've followed closely, and I find it very consistent.

Re:Under the Hood with Java 10 Enhanced Generics by lmm on Tuesday December 30, 2014 @03:23AM (#8813795)
Ceylon is very nice, and probably is more consistent; first-class union types are a really good idea. Its Java interop story isn't quite as good as Scala's (without existential types, you can't express many Java generic methods - and try calling a Java generic method with a Ceylon tuple), and I don't think I could live without higher-kinded types and some equivalent to for/yield (do notation). But it does feel pretty elegant so far; we'll see if it can keep it up through years of language evolution.
Re:Under the Hood with Java 10 Enhanced Generics by lukedegruchy on Tuesday December 30, 2014 @07:16AM (#8814259)
Java interop is way better with Ceylon 1.1. For example, use-site variance for generics was introduced and overloading bugs have been resolved. Ceylon 1.2 will have constructors (to support DI frameworks) and I believe Java EE integration. The Ceylon guys have been very careful about adding new features, considering the pros and cons. Strict Java interoperability would have resulted in a much less elegant language (ex public/protected/private instead of shared and allowing an escape hatch for null, as Swift and Kotlin have done).
Re:Under the Hood with Java 10 Enhanced Generics by eropple on Tuesday December 30, 2014 @01:26PM (#8815864)
Yeah, having looked at Ceylon 1.2 I withdraw the "or Ceylon" part of what I'd said above. It's a lot nicer than when I'd looked at it before. I'd still go to Scala first, but that ain't bad.
Re:Under the Hood with Java 10 Enhanced Generics by kasey_junk on Monday December 29, 2014 @10:49PM (#8813230)
Let me preface this by saying I've been a full time Scala dev for a few years now, and routinely make the choice to use Scala in new projects.

That said, the complaints about Scala's complexity are not overblown in the least. If you ever had the opportunity to move from one Scala team to another, or to integrate 2 Scala teams that had grown independently previously, you see that even saying you are a Scala team does not narrow down significantly what to expect when opening up the code base. There is so much variance in what is and is not idiomatic Scala, that even the Scala standard libraries are a mix of styles and best practices. As for Scala steering you towards the "Right Thing", I'd argue that the Scala community has not settled on what that is (to the point of schism) and my experience indicates that quite the opposite is true.

As far as IDEA achieving parity with Java, the very concept is laughable. Simple things like safe refactorings aren't, and syntax highlighting mistakes and phantom compile errors are common. While the IDE story in Scala has improved dramatically over the years, to say it is Java level is over selling it.

Re:Under the Hood with Java 10 Enhanced Generics by papauschek on Tuesday December 30, 2014 @08:31AM (#8814484)
Would love to hear in more detail about your experiences integrating Scala teams and the challenges that come with it.

I only worked in a small team so far (3 devs) and had a good experience introducing Scala, but I can imagine that with people who have previous Scala experience and "their own style" can be problematic.

Re:Under the Hood with Java 10 Enhanced Generics by kasey_junk on Tuesday December 30, 2014 @12:10PM (#8815463)
The single biggest problem facing Scala right now is a lack of a true idiomatic style. When opening a Scala code base you can encounter everything from "Java without semicolons" to "scalaz style operator soup" and everything in between.

Added to this is that "best practices" have migrated pretty significantly over time, and things that many people thought of as very beneficial are now often seen as problematic (xml support, mixins, large for comprehensions, implicit conversions, etc) but not everyone agrees on these.

Compounding all of this is that the Scala "defaults" can lead to some pretty heinous problems and experienced Scala developers often have opinions that seem to directly contradict what Typesafe is selling (for instance, Akka, Play, the collections library, sbt etc. are all subject of ire for lots of people who have used them extensively).

Re:Under the Hood with Java 10 Enhanced Generics by jordanpg on Monday December 29, 2014 @05:57PM (#8812286)
MS has announced that .NET will be supported by "all big platforms". We all anxiously await the download page that contains an MS-branded OS X CLR.