News for hackers. Stuff that matters.
Re:Guide to the CoreCLR Source Code by cm2187 on Friday March 24, 2017 @12:37PM (#13950136)
gc.cpp, 37,000 lines of code. And some want to remove Regions from the .net framework!
Re:Guide to the CoreCLR Source Code by matthewwarren on Friday March 24, 2017 @12:41PM (#13950164)
Yeah people always find that file surprising.

I think the reason for it being soo large is that the GC is shared across all the .NET versions, so having it in one file has some advantages.

See https://github.com/dotnet/coreclr/issues/408 for a discussion on reorganizing it.

Re:Guide to the CoreCLR Source Code by LeanderK on Friday March 24, 2017 @01:17PM (#13950520)
sadly, no. Excerpt from the issue

> In #401 @cnblogs-dudu referenced a post explaining that the GC was machine-generated from LISP. Since gc.cpp is not a real source code (just intermediate code), but the lisp code is, should it be more useful to publish the lisp source and the transpiler (Source-to-source compiler) for LISP -> CPP?

Re:Guide to the CoreCLR Source Code by matthewwarren on Friday March 24, 2017 @01:20PM (#13950557)
It's my understanding that the LISP -> CPP was only done in the beginning and is no longer carried out. I.e. all recent development is done directly in the .cpp source.

There's a reply from a Microsoft employee that seems to confirm this, see https://github.com/dotnet/coreclr/issues/408#issuecomment-78...

Re:Guide to the CoreCLR Source Code by teh_klev on Friday March 24, 2017 @02:59PM (#13951311)
Here's a comment by Patrick Dussud on an old blog entry explaining the LISP origins of the GC:

https://blogs.msdn.microsoft.com/patrick_dussud/2006/11/21/h...

I thought I knew a thing or two about .NET, having used it since beta days, I had no idea LISP was used to bootstrap the original GC code. Fascinating stuff.

I've archived it here just in case:

http://archive.is/1qk25

Patrick is also interviewed on Channel9 and he talks about the GC. Not watched it yet:

https://channel9.msdn.com/Shows/Going+Deep/Patrick-Dussud-Ga...

Re:Guide to the CoreCLR Source Code by matthewwarren on Friday March 24, 2017 @06:53PM (#13952890)
Yeah that's a great video, he really knows his stuff!
Re:Guide to the CoreCLR Source Code by UnoriginalGuy on Friday March 24, 2017 @03:56PM (#13951776)
Regions aren't a .Net Framework feature, they're a language feature.

There's absolutely no reason they should be in C# and encourage bad coding practices (like overly long .cs files). Even if you need all your code in a single class, you can shard that class across several .cs files to make organisation and maintainability easier.

Regions are just a crutch people use to allow them to create 10K+ line .cs files that will eventually become a maintainability nightmare (as well as making merges/check-ins/finding things more annoying in general).

Only region I'll use is the built DEBUG one and I only use that to create:

     private bool IsDebug()
     {
     #if DEBUG
       return true;
     #else
       return false;
     #endif
     }
Stackoverflow answer for why regions are bad: http://softwareengineering.stackexchange.com/questions/53086...
Re:Guide to the CoreCLR Source Code by taco_emoji on Friday March 24, 2017 @05:39PM (#13952444)
I agree about regions, but `#if` et al are preprocessor directives, not regions. They actually influence how your code is compiled.
Re:Guide to the CoreCLR Source Code by lazyman75 on Saturday March 25, 2017 @06:18PM (#13957821)
Well, just because YOU cannot write good code with regions doesn't mean it's a bad feature. It's actually very very useful thing, but as with everything, you have to know when and how to use it.