

Introduction to the Common Language Runtime (2007) - StylifyYourBlog
https://github.com/dotnet/coreclr/blob/master/Documentation/intro-to-clr.md

======
CmonDev
Also known as The Best Virtual Machine. It would be nice to see the 64-bit
Mono vs JVM vs V8 (or whatever monkey it's called this time) in a year or so.
.NET CLR was already destroying every other on Win (even before RyuJIT and
SIMD and native compilation), now Linux will be covered as well.

~~~
nercury
I think the JavaScript virtual machines are amazing. Thanks to browser speed
wars, they pulled out a trick that I would not have thought possible - making
JavaScript fast as hell.

Calling V8 "whatever monkey" is a bit ignorant.

Oh, I haven't said that JavaScript is a good language :)

~~~
_random_
Unfortunately it pushed the industry on the wrong path. Now everyone is coming
app with transpilable super-sets and some folks are even pushing the
unmaintainable code to the previously safe server-side (node, meteor etc.).

~~~
k__
Yes.

Just look what Lars Bak did with JavaScript.

If he would work on the CLR, things could get really awesome.

~~~
the_why_of_y
You mean it could become as awesome as the HotSpot JVM, which was originally
based on the StrongTalk VM for SmallTalk, which was in turn based on the Self
implementation from Sun Labs? (hint: Lars Bak worked on all of the above)

[http://www.strongtalk.org/](http://www.strongtalk.org/)
[http://www.selflanguage.org/](http://www.selflanguage.org/)

~~~
k__
I don't know how much hacks he had to use for the JVM and V8 that could be
left out in the CLR.

AFAIK he didn't create those things from scratch, he had to use the Java,
SmallTalk, Self and JavaScript specs that were already out in the wild.

------
peferron
From the article: "A GC _is_ necessary to provide memory safety guarantees.
[...] For any programs that need heap-style memory allocations, if you want to
guarantee memory safety, you _need_ a GC."

The main clame to fame of Rust is providing memory safety _without_ a GC. Is
the quote wrong, or is the quote still right because using a few unsafe blocks
is unavoidable in practice? I haven't used Rust yet and know almost nothing
about the language, so I'd be glad if someone could enlighten me.

~~~
raphaelj
You will always need a kind of GC if you start allocating things on the heap.
This is because, in some cases, it's impossible for a human or an algorithm to
know statically where a memory can be deallocated (you could solve the halting
problem if you had a such algorithm, yet the halting problem has been proven
unsolvable).

The GC can be very primitive such as in Rust ou C++11 by using reference
counting. Reference counting is not a static allocation.

What Rust introduces is memory safety for statically allocated data. That's,
the type system will prevent you use a reference/pointer to data a which has
been deallocated.

~~~
falcolas
Thank you for bringing this up. Rust does indeed use GCs when it is unable to
perform static lifetime analysis, or perhaps more importantly, when the
restrictions imposed by the lifetime analysis prove too restrictive for the
programmer to solve a given problem.

------
Rapzid
Very nice. I'm wondering and hoping that Microsoft will start releasing
design/architecture documentation and walkthroughs. Something that's sorely
lacking from most open source projects is any sort of documentation to help
would-be contributors get up to speed and wrap their heads around things. On a
lot of smaller projects it's not a huge deal, but some of the new dotnet
foundation stuff is MASSIVE.

~~~
MichaelGG
Yeah this is great. I'm really looking forward to detailed docs and
explanations of some of the more low level and not-so-publicly understood
parts.

For instance, AFAICT, the whole double locking initialization question doesn't
have a sold public answer. It's unsure that "myfield = new Foo()" is totally
safe if the constructor throws. Obviously that'd be a huge flaw if not safe,
but even top C# experts don't seem to be sure. With a fully open source CLR
and docs, we should be able to figure this stuff out, rather than finding a
few things of blog posts from 2004 and guessing.

We could also learn why some things are the way they are. For instance, why
can you lock (Monitor) on _every_ object? The syncblock on each object can't
be free, so why is this encoded into each object (or even available at all),
versus dedicated sync objects (which are what gets used in practice, anyways).

And maybe someone will provide much needed enhancements, like a way to
effectively use the stack when safe. Or maybe some research projects will add
advanced type features, which spark the way forward into the actual
implementation.

I'm very much looking forward to this and really hope it marks a new era
beyond hassle-free use on Linux.

------
moomin
Just to point out that, as much as the CLR was specced as cross-language, it's
damn hard to run Java on it, Python and Ruby are abandoned, no-one's even
tried Haskell.

~~~
Solarsail
Isn't this a general problem of cross-language VMs? Different languages need
different object models, and different data representations. [0] At least
according to one Parrot developer, the Parrot object model was one of the
biggest pain points for porting JS/Ruby/Python to Parrot... Where that object
model was meant to be universal, and work for any language. [1] That said,
IronPython does still semi-exist [2], and I'm not sure how well JRuby handles
interoperability with Java or Jython...

[0] One former dev on one of the Iron* languages posted on reddit about how
the CLR failed on its cross language ambitions. I can't find the post, but
they gradually found it was mostly C# centric anyways, and ports of other
languages were mostly incompatible and second-class

[1]
[http://whiteknight.github.io/2015/01/15/parrottheend.html](http://whiteknight.github.io/2015/01/15/parrottheend.html)

[2]
[http://ironpython.net/announcements/](http://ironpython.net/announcements/)
for what it's worth...

~~~
larsberg
It's a hard problem, which the COMPlus team knew when they started out. During
the early pre-release period, there was a then-NDA-only project, Project 7,
which gave grants to people trying to port both commercial languages like perl
and academic languages like scheme. I was at Northwestern, where we got a
Project 7 grant to work on a scheme implementation (under Ian Horswill, done
by Pinku Surana in my group) and scheme language service (done by me).

We provided a lot of feedback, but it's tough for a group of a couple of
students (or in the case of Perl, one commercial dev) to keep up with the then
massive-breaking-changes drops we'd get from DevDiv every 3 months or so and
provide feedback when it was on stuff that was, to the developers, around 6
months old. Often, by the time feedback landed, it was "too late" to
incorporate because of product cycles and got postponed. Or the stuff we'd
request was a dupe of "add tail call instruction" which had been postponed
long before any of us got started in Project 7.

I say this as somebody who then graduated and then went to work in DevDiv for
the next 7 years, where I was treated very well, so I certainly have no axes
to grind on that front :-)

~~~
moomin
The strange thing is they seemed to have had a bit of cognitive dissonance
from the outset. They wanted to support Java and JavaScript, but the semantics
of their Java and JavaScript basically made them different syntaxes for C#. On
the other hand, they've put a lot of effort into support tail calls. On the
third, it's only really used by F#, which is .NET specific. :(

------
tkubacki
Mono team is now actively merging this into Mono (see Miguel De Icaza github)
- this is very good news for .NET

------
_random_
2016-s default gentlemen's choice: Azure, Win10, Docker, CoreCLR, ASP.NET Web
API, F#, TypeScript.

~~~
MichaelGG
Azure is a nice offering, pretty slick. But the costs of compute on Azure are
literally 200% of Google Cloud Compute Engine. And the performance of GCE is
also better.

I'm very anti Google, and I had dismissed GCE out of hand. But then I looked
into it and tried it out and I'm blown away. VMs launch like instantly, and
are much faster than their Azure counterparts. Niceties, like SSH in the
browser really are cute, too. And, each machine can have a public IP, instead
of Azure's quirky "cloud service" one IP limitation.

But pricing, that's what kills you. While Azure makes a big deal about how
they match pricing, it's only on the storage/transfer sides. The same specs on
Azure are 200% more money. The same performance is... a lot more money. I
think it's cause the main tier of Azure runs on some older AMD series, but GCE
is running Ivy/Sandy bridge.

As a longtime Azure user, I was rather distressed to find I was paying so much
more for less. Even after the discounts MS had for 6 or 12 month commits,
their pricing is still far more.

Also s/TypeScript/WebSharper.

------
mmf
Wait a second. Isn't the elefant in the room the fact that Microsoft is open
sourcing a core piece of their software? And MIT license!!! What's happening?

------
std_throwaway
I'm wondering how this relates to LLVM or JAVA bytecode.

------
JBiserkov
>fundamentally only simple things can be easy

------
Too
Look at the repository the file belongs to. :)

~~~
Udo
I have no idea who Vilius Kairys is, care to elaborate?

~~~
josteink
The _repo_. It's coreclr. .NET is now open source to the core.

~~~
worldsayshi
It seems that it also works on linux? So it works as a replacement for Mono
then? I guess the compilers are missing. But I guess you can use the mono
compilers and then clr.

~~~
math
They open sourced their compilers earlier:
[https://github.com/dotnet/roslyn](https://github.com/dotnet/roslyn)

~~~
worldsayshi
build:failing :/

