News for hackers. Stuff that matters.
Re:Anders Hejlsberg – What brought about the birth of the CL... by zerr on Sunday May 03, 2015 @02:23PM (#9482374)
Also interesting - why this kind of framework (.NET) required to be under managed runtime instead of being native? Like Delphi.
Re:Anders Hejlsberg – What brought about the birth of the CL... by pron on Sunday May 03, 2015 @03:30PM (#9482651)
People often say "managed runtime" or "VM" but those things are not clearly defined. For example, if we look at Java and .NET, the two best known language VMs, they really provide few completely orthogonal features:

1. OS isolation -- the VM provides a platform-neutral API for OS services, and abstracts away details like clocks etc.

2. Intermediate language representation, a JIT (or several JITs, in the case of the JVM) and dynamic code loading/manipulation.

3. A GC (or several GCs, in the case of the JVM).

Each of these features is completely independent (in fact, some JVMs don't even provide #2, opting for AOT compilation. Golang, OTOH, is not perceived to run in a "VM" -- simply because its "managed runtime" is statically compiled with the program, and no JIT is available -- yet it provides #1 and #3, just like some JVMs).

Now, as to why you'd want to provide each of those features -- well, there are different reasons. #1 is great for cross-platform portability. #3 is great for simplifying programming, esp. in multithreaded settings. #2, the JIT, is actually an optimization layer with some tradeoffs. A JIT can always produce machine code at least as efficient as the most sophisticated profile-guided optimizing compiler, and then some; to do that, it trades off warmup-time, and extra CPU cycles that can make a difference on energy-constrained platforms (although a JIT with caching might enjoy both worlds). In addition, a JIT is an absolute necessity when trying to achieve high-performance when running dynamically-typed languages. Another downside to JITs is that they're very hard to write well (i.e. while they can surpass the code quality emitted by AOT compilers, it takes more effort to even match that quality).

So, in general, there is no such thing as a "managed runtime" -- just a collection of features, each with its own motivation. That name also has a connotation of overhead, which again, is completely false. A GC may add some overhead (RAM, latency) but may also reduce overhead (throughput, more scalable concurrency) -- depending on your application. A JIT may add overhead -- warmup time, extra cycles -- but may also reduce overhead (more efficient generated code).

Re:Anders Hejlsberg – What brought about the birth of the CL... by zerr on Monday May 04, 2015 @04:13AM (#9484927)
> So, in general, there is no such thing as a "managed runtime" -- just a collection of features

To rephrase my question - why it is not possible to have statically linked this collection of features into standalone executable? Like Go. I understand that Go is bare-bones compared to .NET, but Delphi/C++Builder also supports fully standalone executables. As for cross-platform (source) portability - it could use Ahead-Of-Time compilation into native exe.

Re:Anders Hejlsberg – What brought about the birth of the CL... by pron on Monday May 04, 2015 @04:29AM (#9484972)
OK, so you're talking about AOT compilation, i.e. doing away with the JIT. Of course it is possible. There are even JVMs that do just that. The question, then, is when is AOT compilation (and static linking) desirable? There are, of course, many situations where it is and many when it isn't.

Go is designed mostly for smallish programs (command line programs like Docker or simple services), so static AOT compilation and static linking makes sense.

Java, OTOH, is mostly used in large, important, performance-critical server-side services, where the added performance offered by having a JIT is important, and the warmup time isn't, while dynamic linking allows for dynamic code loading/swapping.

Just like there are JVMs that do AOT compilation to a native binary, there's nothing stopping .NET from doing the same[1]. There's also nothing stopping a single SDK from providing both options. It usually boils down to a question of what the users of that SDK need.

[1]: I would bet that that's exactly where MS is going. Like I said before, writing a good JIT is hard, and OpenJDK's HotSpot is years ahead of the CLR in that respect and only widening the gap with its next-gen JIT, Graal. I think MS would realize that it's easier for them to just do AOT.

Re:Anders Hejlsberg – What brought about the birth of the CL... by overgard on Sunday May 03, 2015 @02:33PM (#9482418)
You can compile C# native now.
Re:Anders Hejlsberg – What brought about the birth of the CL... by StevePerkins on Sunday May 03, 2015 @02:48PM (#9482477)
Well... certain C#, which I don't know anyone actually writing (i.e. Windows 10 Universal apps).

It would be interesting if you could compile a traditional desktop app into a dependency-free EXE, or bundle up an ASP.NET app with an embedded server as you can with modern Go microservices. I would go from "somewhat interested" to "chugging Kool-Aid and changing my career path" if those use cases entered the picture. I'm not sure whether either of those are in future plans, though.

Re:Anders Hejlsberg – What brought about the birth of the CL... by overgard on Monday May 04, 2015 @01:20AM (#9484450)
> It would be interesting if you could compile a traditional desktop app into a dependency-free EXE

I might be wrong about this, but my understanding is you can do this. The restrictions are mostly just about certain uses of reflection and dynamic linking.

Re:Anders Hejlsberg – What brought about the birth of the CL... by akoeplinger on Sunday May 03, 2015 @06:23PM (#9483320)
> or bundle up an ASP.NET app with an embedded server

You can do that today: http://docs.asp.net/en/latest/conceptual-overview/dotnetcore...

Re:Anders Hejlsberg – What brought about the birth of the CL... by StevePerkins on Sunday May 03, 2015 @08:56PM (#9483759)
I have been reading about ASP.NET 5 with much interest, but I'll probably engage with it more seriously in six months or so. It was still pretty flaky when I tried to get an OS X environment up and running last week.

It's also a bit confusing whether this "Kestrel" embedded server is production-grade (like Golang, or the embedded server options for Spring Boot in the Java world)... or whether it's meant for development only (https://www.nuget.org/packages/Kestrel).

It's amazing that CoreCLR is coming to multiple platforms within the next year or so... but what IS the production deployment story for Linux going to be, seriously? What is the development story for OS X? (VS Code looks interesting, but surely they're going to have to port the "real" Visual Studio, right?)

Don't get me wrong, I'm not a naysayer! Since I've started exploring .NET, I've found C# to be an improved version of Java that I'd really like to work with. F# seems like a more coherent alternative to Scala. Documentation, availability of learning resources, and community friendliness are outstanding. Still, I'm not 100% convinced yet of the cross-platform reality living up to the extraordinary hype. It really is too soon to judge, but I'm definitely watching closely and believe that the next 6 to 12 months will be crucial.