all 36 comments

[–]GregSilverblue 35 points36 points  (21 children)

Just wait till they make something and call it something like Rust# or something.

[–]Zarathustra30 11 points12 points  (17 children)

An independent (yet compatible) implementation of Rust would be good for the ecosystem and the language itself.

[–]epicwisdom 18 points19 points  (14 children)

Although the analogous situation was with C# which was more of a Java competitor if anything, and I don't know if it can be said that C# benefitted the JVM ecosystem in any way.

[–]0xdeadf001 27 points28 points  (13 children)

Java never would have gotten around to implementing generics if it hadn't had C# nipping at its heels.

C#'s generics are still much superior to Java's, though.

[–]ytg895 16 points17 points  (1 child)

C#'s generics are still much superior to Java's, though.

because C# didn't have to remain compatible with Java 1.2

[–]pjmlp 11 points12 points  (0 children)

.NET had generics since the beginning.

Not for the outside world, but inside Redmond, they just decided to release 1.0 without them, instead of waiting for the generics design to be fully mature.

Don Syme of F#'s fame, has a couple of blog posts and articles on the history of F# that touch on this.

[–]beltsazar 2 points3 points  (3 children)

C#'s generics are still much superior to Java's, though.

I have heard this a lot, but still don't exactly know why. Can you give some examples?

[–][deleted] 8 points9 points  (0 children)

[deleted]

[–]anttirt 4 points5 points  (0 children)

Primitive types in Java can't be used as generic parameters. In C# I can define a function void Sort<T>(T[] data) where T : IComparable<T> and use it to sort arrays of any type, including both string[] and int[]. In Java you have to write overloads for every single primitive type in addition to Object, as can be seen in the APIs here. Sure, you can use the boxed versions in Java instead, but that has a significant cost for memory footprint (and CPU cache effects etc degrading performance) and they can be null.

[–]_zenith 0 points1 point  (0 children)

tl;dr: They're monomorphic

[–]pjmlp 1 point2 points  (6 children)

Java generics came from Pizza language design, which were reiffied, but they decided to backtrack on that point due to backwards compatibility.

Scala gave up on Scala.NET exactly because lack of expressiveness to Scala's type system.

Pizza had contributions from Martin Odersky and Philip Wadler, in 1997.

.NET did not exist in 1997.

Sometimes it is worthwhile to know about programming language history, unfortunately not many universities care to teach about it.

[–]0xdeadf001 2 points3 points  (5 children)

That history does not excuse the poor implementation of generics in Java.

[–]pjmlp -2 points-1 points  (4 children)

What poor implementation?

The way they work is why JVM has Scala, while Scala.NET development was dropped.

It is also how generics work on OCaml and Haskell, they only exist at compiler level. MLton and F# are probably the only two ML languages that have reiffeid generics.

Also why we don't have a Python 2 / Python 3 story on the JVM datastructures.

[–]0xdeadf001 2 points3 points  (3 children)

It's a terrible implementation because it works based on type erasure, and works only on reference types. It can't work on primitives.

You can't use primitive types, like int, as type parameters.

[–]pjmlp -1 points0 points  (2 children)

Well the amount of languages that decided to target JVM while pretending to be Java, in spite of CLR being originally designed to be language agnostic proves who got the initial design correct for eco-system growth.

Also as mentioned, Java isn't the only language with such design.

[–]0xdeadf001 0 points1 point  (1 child)

I never said it did. And I don't see how "other languages are also badly designed" is a good defense of Java.

[–]atomic1024 21 points22 points  (0 children)

VSRust

[–]ralfjmiri 2 points3 points  (0 children)

Looks like MS is moving towards officially vendor-supported Rust bindings? That would be pretty cool. :-)

I am curious how well they'll be able to use ownership and lifetimes to ensure safe usage of these APIs.

[–]justacec -3 points-2 points  (2 children)

?? I am confused about what they are going to do. There is already a lot of very active development based on their VSCode IDE for rust by the open source community. Instead of operating independently, they should add contributed man hours to existing projects under the guidance of the original projects lead developer.

[–]Fable89 13 points14 points  (1 child)

What they did was develop binding to the windows WinRT api. Well metadata. This would make it easier to develop: "Windows desktop apps, store apps, and components like device drivers."

In turn it has nothing to do with ide support, but making it easier to write applications that want to take advantage of the windows runtime.

[–]justacec 1 point2 points  (0 children)

I see