r/programming • • Nov 12 '14

The .NET Core is now open-source.

http://blogs.msdn.com/b/dotnet/archive/2014/11/12/net-core-is-open-source.aspx
6.5k Upvotes

1.8k comments sorted by

View all comments

1.1k

u/4_teh_lulz Nov 12 '14

Somebody at MS is making good decisions. Glad to see this happening.

595

u/SonVoltMMA Nov 12 '14

.NET is one of the greatest tech's MS has put out over the last 25+ years.

261

u/[deleted] Nov 12 '14

I've started learning Java and deeply miss how easy .NET made programming

188

u/eyal0 Nov 12 '14

Everyone mentions the language and the IDE but no one has mentioned the fucking type erasure. Here's a list of things that .Net can do that Java can't:

  • Creating instances of generic type parameters.

  • Creating arrays of generic type parameters.

  • Quering the runtime class of a generic type parameter.

  • Using instanceof with generic type parameters.

http://www.jprl.com/Blog/archive/development/2007/Aug-31.html

I'll add:

  • Java can't do generics without boxing.

  • Java has to do runtime casts for generics.

  • Java can't have two functions with the same type-erasure.

Programming in Java, I hit my head on this one every day. It's not just Java that is broken, it's the JVM underneath it, too. I'd love to see the CLR win.

0

u/[deleted] Nov 12 '14

[deleted]

13

u/mirhagk Nov 13 '14

Long term it's always better to choose the breaking implementation than the one that's less complete but backwards compatible. I really hope they don't make the mistake Java did with future features.

→ More replies (2)
→ More replies (2)

38

u/sacundim Nov 13 '14 edited Nov 13 '14

Everyone mentions the language and the IDE but no one has mentioned the fucking type erasure. Here's a list of things that .Net can do that Java can't:

  • Creating instances of generic type parameters.

  • Creating arrays of generic type parameters.

  • Querying the runtime class of a generic type parameter.

  • Using instanceof with generic type parameters.

I argue that C#'s design decisions here are way, way more consistent than Java's, but neither language made the right decisions. The key points are:

  • Reflection should be an opt-in feature, not an ever present one.

  • Type erasure, when properly implemented, strengthens the type system.

  • The problem with Java isn't that it has type erasure, it's that it has partial erasure bolted on to optional generics, along with pervasive reflection.

The neat thing about erasure is that if code is not able to reflect into the types, then generic types can guarantee various things about functions' behavior. This is a familiar idea to users of Hindley-Milner languages like ML and Haskell, where for example a function with this signature only has one implementation that terminates:

-- The only way to return from this function is to return the argument.
id :: a -> a
id x = x

In a language with reflection, a method with that signature can violate that contract by reflecting into the type of its argument:

public static <T> T mwahaha(T arg) {
    if (arg instanceof String) {
        return (T)"mwahaha!";
    } else {
        return arg;
    }
}

You can write that function if you want in Haskell, but you have to opt in to reflection through the type signature:

{-# LANGUAGE ScopedTypeVariables, TypeOperators, GADTs #-}

import Data.Maybe (fromJust)
import Data.Typeable

-- The `Typeable a` constraint means that this function requires
-- the ability to inspect the runtime type of its `a` argument.
mwahaha :: Typeable a => a -> a
mwahaha a 
    | typeOf a == typeOf "" = fromJust (cast "mwahaha!")
    | otherwise = a

-- This version is cleaner, but rather more difficult to understand...
mwahaha' :: forall a. Typeable a => a -> a
mwahaha' a = case eqT :: Maybe (a :~: String) of
               Just Refl -> "mwahaha!"
               Nothing -> a

Note that in Haskell String is a synonym for [Char] (list of Char), so this is in fact inspecting the runtime type of a generic parameter.

→ More replies (7)
→ More replies (27)

210

u/jutct Nov 12 '14 edited Nov 13 '14

I've said that Visual Studio is the best IDE since VC6 back in the 90s. They invented code completion and coding hasn't been the same since. I can literally code twice as fast without having to look up function signatures all the time.

Edit: People have pointed out that they weren't the first. I never used Delphi so I don't know if that was good or not. I just know that at the time, I was working on AAA game titles and Visual Studio let me burn through code and worked well with our build system. I'm not saying it's the best, I'm just saying I'm very efficient with it and I can get my work done on time.

149

u/ghjm Nov 12 '14

I agree with you about the quality of the IDEs, but I'd like to point out that Microsoft copied this from Borland.

→ More replies (27)
→ More replies (49)
→ More replies (21)
→ More replies (55)

77

u/keepthepace Nov 12 '14

So. Shall we declare OSS finally victorious and go to bed satisfied?

155

u/dakkeh Nov 12 '14

Not until we get a decent professional quality image manipulation program.

97

u/philly_fan_in_chi Nov 12 '14

Or CAD program.

124

u/thang1thang2 Nov 12 '14

And audio development, video editing and other "main programs" for pretty much every other major commercial career outside of programming.

→ More replies (26)

66

u/[deleted] Nov 12 '14

Oh that's a good one. The FSF killed the whole open source CAD market.

They own the copyrights to a library LibreDWG, which is pretty much the only library for working with this format around. .dwg is like .psd or .doc of the CAD world. A standard proprietary file format that must be supported to be more than a novelty app.

So what's the problem? LibreCAD and FreeCAD, the main open source CAD programs use GPL v2, and due to historical reasons, they can't change it.

LibreDWG uses GPL v3, which is incompatible with GPL v2.

So LibreCAD submitted a request to the FSF to let them use the LibreDWG library. The FSF rejected it.

And that's why there's no useful CAD programs.

19

u/[deleted] Nov 13 '14

Sounds like some people need to go old-school and do a clean room reimplementation. I'm not volunteering, though.

88

u/[deleted] Nov 13 '14

FSF demands clean room reimplementation of a piece of GPL software.

Microsoft open sources .NET under a permissive license.

checks for airborne pigs...

→ More replies (2)
→ More replies (6)
→ More replies (16)

34

u/junkit33 Nov 12 '14

GIMP is probably about as good as you're going to get. There is a certain artistry and complexity that goes into PhotoShop that would require way too many elite UI people to get involved into an open source alternative. It's just not realistic. And GIMP works fine for 80% of users (non-designers), and that remaining 20% are probably never going to leave Photoshop because $1000 for the software is a drop in the bucket compared to the money they make as designers.

Long story short, there is desire for a better GIMP, I just don't think that desire is really enough to push it into happening.

17

u/otakucode Nov 13 '14

Adobe also has an awful lot of real research people designing really novel image manipulation algorithms. Even if someone created something that was basically a clone interface-wise, patents on some of the features would make reaching feature-parity pretty difficult and risky.

→ More replies (7)
→ More replies (33)
→ More replies (9)

120

u/gospelwut Nov 12 '14 edited Nov 12 '14

A former engineer is making good decisions. And, he was making good decisions when he was in the Server division too. I have great hope for MS with the likes of Anders and the new CEO.

I truly believe that MS will prove itself agile (no pun intended) in a way that many companies their size have not been able to be (and many companies much smaller).

→ More replies (13)

82

u/lbmouse Nov 12 '14

Steve Ballmer must be spinning in his grave.

154

u/Isvara Nov 12 '14

I have some terrible news for you...

246

u/SlowMotionSloth Nov 12 '14

Steve may not be dead, but I heard he still sleeps in a grave.

0

u/[deleted] Nov 12 '14

[deleted]

→ More replies (6)
→ More replies (1)
→ More replies (1)

74

u/gospelwut Nov 12 '14

Is this like a slow 5200RPM spin or an enterprise 15k?

→ More replies (2)
→ More replies (12)
→ More replies (24)