dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]Is the C compiler a CLS extender?


From: Fergus Henderson
Subject: Re: [DotGNU]Is the C compiler a CLS extender?
Date: Tue, 16 Sep 2003 22:04:33 +1000
User-agent: Mutt/1.3.28i

On 05-Sep-2003, Rhys Weatherley <address@hidden> wrote:
> On Friday 05 September 2003 09:39 am, Mark Easton wrote:
> > Just a very quick question, but I've been reading the CLI specs again (I
> > know, it'd be healthier to get a social life but those specs send me
> > wobbly at the knees) and I'm wondering if the C compiler can actually
> > create CLS compliant code or not?

This is a quite different question than the one in the subject line!

The three questions
        - can tool X create CLS-compliant code?
        - is tool X a CLS-complaint producer?
        - is tool X a CLS-complaint extender?
are all different.

Please be precise with your language, because otherwise it is impossible
to give you meaningful answers.

> > I know it pumps out IL, but I'm
> > guessing it can't do much with attributes which I assume means it can't
> > actually generate CLS compliant code.
> 
> Actually, it has more to do with types than attributes.  The C compiler 
> outputs global methods and fields in the "<Module>" type, which are not 
> normally going to be accessible to a strict CLS-compatible language.

The approach of other language developers who wanted their tools to
fit the category of ECMA-compliant CLS *producer*, was to generate
static members in a class with a particular name, e.g. "Globals".
This was instead of generating IL ".global" functions or ".global"
data, because IIUC those are BAD (Broken As Designed) because they are
not CLS-compliant.  (Can't easily check right now, since I'm in an
internet cafe in Perugia.)

> C programs also make heavy use of unsigned types.

That's OK; a CLS-compliant producer is allowed to support unsigned types.
It just means that programmers who want to write C code which can be
used from any CLS-compliant consumer need to refrain from using unsigned
types in their interfaces.
 
> Of course, where it makes sense for the C compiler to be CLS-compatible, then 
> we will be; e.g. when calling C# code from C.  Unfortunately, Microsoft 
> didn't define a CLS profile for languages that lack classes, like C does.  

The two CLS categories "consumer" and "producer" are appropriate for
languages that lack classes.

-- 
Fergus Henderson <address@hidden>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]