Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As a Java and JVM focused developer the openning up of .NET really excites me. First, because .NET is a fantastic framework in and of itself, but also because this hopefully will encourage Oracle to be faster and more competitive with Java features and improvements.


> Oracle to be faster and more competitive with Java features and improvements.

Please don't hold your breath. Millions of programmers die every year from hope-influenced asphyxiation.


I'm not sure that's fair. Java 7 and 8 have made some great improvements. The release cycle is fairly frequent and it's actually possible to migrate software easily enough unlike the python 2.7->3 standoff.


I'm still waiting for everyone to move to Python 3.


There is a difference between change mismanagement and not willing to invest in language development.


I know what I am about to say is both heresy and insanity, but maybe we could get a C# implementation that compiles to the JVM?

I mean, yes, C# has been largely open-sourced already. But with the new compiler framework being opened up also it seems imaginable that someone could write a version that spits out Bytecode instead of MSIL.

I have nothing against the JVM, but am not a huge fan of the Java language (and also how the Java libraries have been forced to be developed due to limitations within Java the language).

Yes Java 8 made Java much MUCH better than before, but just because Java 8 is a around doesn't mean all the libraries and other underpinnings got magically updated overnight.


One of the primary problems with this is generics (java/JVM uses type erasure, CLR/C# keeps type information) and value types (CLR/C# has them, JVM does not); That's why you can implement the JVM on the CLR (see IKVM.NET[1]), but not the other way around.

[1]: http://en.wikipedia.org/wiki/IKVM.NET


I'm not a vm or compiler expert by any means but Gosu and Ceylon have implemented reified generics on the JVM somehow. It seems possible, but I don't know what the performance impact would be.


Well it's obviously doable — both the JVM and CLR are equivalent to Turing machines, so it follows that they can run the same set of programs. It just, uh, might be non-trivial. :)


Fwiw, when Gavin King (Ceylon) did a AMA on Reddit a while back I asked about how they implemented reified generics on the JVM:

https://www.reddit.com/r/programming/comments/2iszra/ceylon_...


Ceylon is a great language in my opinion. I would rather programm in Ceylon than in C#.


That's good to hear! I haven't played with it yet beyond flipping through the docs.

Have you built any production ready apps or libraries in it? How was the transition from writing Java? Did anything cause you pain or surprise?


The Eclipse IDE plugin works but is pretty slow. I wouldn't use it if I wasn't so used to autocompletion + documentation in my IDE.

The module system can use the central maven repository but it doesn't accept dashes in the name like jackson-core unless you put it in quotes. (Took me a while to figure out).

Ceylon doesn't have enums but you can emulate them like this: http://ceylon-lang.org/documentation/1.1/tour/types#enumerat...

Otherwise it's fairly straightforward to translate java into ceylon.

I love immutability by default. Only 10% of my variables/fields are actually mutable. I could reduce that percentage further if the jvm had TCO.


Java is getting value types and replied generics.


Potentially. Value types seem like a lock for 10, but reified generics have only been suggested as a research topic in Project Valhalla.


Somehow F# uses type erasure. I'm not sure how it works, but I know that it does.


Taken at face value I think this is misleading - a typical F# generic type will be represented as a normal .NET generic type at the IL level. However, it is true that some types are erased, like unit-of-measure type arguments or types surfaced by type providers.


Type erasure on the CLR is exactly as it is on the JVM. Generics are needed for interop with generic libraries (which aren't used that much beyond collections anyways in core libraries).

Erasure is necessary when the type system is differently expressive from C#, which I beleive F# is.


It would be super difficult to represent value types, generics and the reflection metadata in the JVM without building some kind of giant abstraction layer. MSIL is rich, maybe overly rich. If you get rid of value types and generics from C# you're basically left with ... Java.


Watch this awesome keynote by Brian Goetz, he talks about valie types and generics.

Brian Goetz - Stewardship: the Sobering Parts

http://m.youtube.com/watch?v=2y5Pv4yN0b0


Not quite. There are still some features that are not possible on the jvm like async/await.


Scala does everything C# does and a lot more. I'm a big C# fan but we're doing new development in scala and even porting some of our C# code over.


Most languages give you enough rope to hang your self with. Scala gives you options to choose brand, width and color from a wide selection. The flexibility of Scala was scary when I started.


However C# is the official .NET systems language, while Scala is a third party language.

This already rules it out from our projects, due to the way our customers manage their IT stacks and development environments.

So I don't need to ask permission to several IT departments to have C# on our projects, but I do need to do it for Scala.


Maybe you are just working for the wrong customers/company.

I decided to never do Java again, and until now I have zero complaints, because I have plenty of offers to pick from.


What matters is what makes the customer happy.

Anyone that wants to bring something new to our projects needs to prove what is the business value. If it reasonable, it gets adopted.

So for Scala to be adopted on our projects, customers need to be convinced what is the business value of having their multi-site team learning it, instead of us using their already installed infrastructure.

I can dabble in alternative programming languages on my hobby projects.


Well, I guess the difference is that I'm not the one who brings up Scala, it's the customers.


Glad to see it working then.


Does Scala do something like Xamarin? Single code base => iPhone, Android, WP, mainstream game consoles, Mac, Linux? It's not about just language.


Since the CLR was designed to be hosted, I don't see why someone just doesn't make a CLR host that runs in/on the JVM, similar to something like SQL-CLR.


Out of curiosity.. Who would want that? What we would be achieving with this?


DB Servers for example.

You can write stored procedures in .NET and Java instead of the engine's own language. Or extend the engine with new functions.

Most of the commercial SQL servers allow this.


I know you can do this, but it would be a bad idea anyway, to support two different IL's instead of just one..

One way to solve something like this, with much less effort and elegance, would be to make both langs output LLVM IR for instance, and jit the native binary from there..

Thats my point, i cant think in any way something like this would be a good idea, given the ammount of resources needed to do something like this for trivial results that would not payoff the efforts.

There is only one scenario that this would make sense, and its on Android, given it is tied to a jit runtime engine, but then , they could just drop CIL and compile from source in a intermediate their runtime would understand, the same one's java is already using.. so again.. no luck with that effort


Just to give one example, Oracle allows this for ages, so it is something real not an idea.


Is the JVM designed to host other runtimes?


Mainsoft did this back in the day; not sure how up-to-date their Grasshopper solution is.

http://dev.mainsoft.com/Default.aspx?tabid=29#top_Licensing


We already have that, and it's called Kotlin.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: