DotNet

But can you maintain that?

February 24, 2005 12:40:50.451

Sriram Krishnan posted something interesting about the CLR garbage collector:

I was talking to a former MSFT employee who worked on the CLR team. The conversation drifted towards languages used to implement virtual machines. Here's what I learnt.

The CLR's Garbage Collection was initially written in Lisp by a Patrick Dussud (I can't find a blog). This code was then run through a Lisp->C converter which was then cleaned up by an intern.

That's interesting - it demonstrates to me that when MS needed something done fast, they knew well enough not to do it in C or C++ (assuming this story is correct, of course). On the other hand, if you do what they did:

  • Write a sub-system in language 1
  • Generate the C from the resulting code
  • Manually modify the results

Can you actually maintain the results? Generated code is always hard to grok. It's one thing if you write in a high level langiage and then generate C (never actually looking at the C) - you can look at the C as something akin to byte code in that case. But if you muck with the generated code before deploying it? I'm not sure that you end up with something you can maintain...

Comments

[Sriram] February 24, 2005 13:13:15.149

My guess is that they used that for rapid prototyping - and then they probably rewrote a lot of the code manually.

Generated code is always hard to grok - NOT

[Alex] February 24, 2005 15:54:14.634

You say "...Generated code is always hard to grok..."

I might buy often but since I generate most of my code, I know code can look just like a good developer wrote it - easily understandable.

[Stephen Pair] February 25, 2005 9:25:27.765

Alex says: "since I generate most of my code, I know code can look just like a good developer wrote it"

Hmmm...that's curious, if the generated code is easy to grok, why do you need the code generator in the first place?

Why the Code Generator?

[Alex] February 25, 2005 10:36:28.004

To save time! (And ensure consistency and correctness.)

400 lines of "DSL" generates 25,000 lines of production, working, easy to read and understand code!

 Share Tweet This
-->