RE: Naive question: C-- vs. CLI

"Simon Peyton-Jones" <[email protected]> Mon, 12 Sep 2005 16:42:56 +0100
Newsgroups gmane.comp.lang.c--
Message-ID <036EAC76E7F5EC4996A3B3C3657D4116032D3CF3@EUR-MSG-21.europe.corp.microsoft.com>
| Since we are implementing a new language, it would appear that we have
| three plausible target runtime strategies:
| 
| 1. Roll our own.
| 2. Use an existing one (probably C--)
| 3. Target CLI.
| 
| I would like to understand what factors should inform a decision
between
| C-- and CLI for research purposes. Can anybody provide informed input
on
| how to evaluate these alternatives for research purposes?

The latter two strategies are very close to:

2a.  Generate assembly code
3a.  Generate Java

If you generate Java you must target Java's type system, accept Java's
object representation, use Java's garbage collector, use Java's
exception semantics etc.  These might be good things if your language is
Java++, but might not if the fit is less good.

If you generate assembly code you control the exact details of object
layout, you write the garbage collector, you write the exception
handling stuff, etc etc.  This could be way more efficient, but there is
more for you to do.

The two strategies are pretty different!  Neither is "better" than the
other.  Targeting Java can save you lots of work, provided you are
willing to buy into a mountain of design decisions that weren't made
with your language in mind.  

It's similar with C-- and the CLI.  C-- is by design very low-level,
although it is much easier to generate than assembly code.  The CLI is
much higher level (more like the Java level) though it has more "hooks"
than the JVM.  But the high-order bit is the same.

Simon