Class Browsers vs Static Types (Re: Inefficiency of __getattr__)

Fergus Henderson fjh at cs.mu.oz.au
Tue Oct 10 03:38:00 EDT 2000


Bruce Hoult <bruce at hoult.org> writes:

>This is wrong.  C++ has *always* been a true compiler that just happened 
>to produce C output instead of assembler (as indeed many functional 
>languages do).  Objective C was originally a preprocessor (and it shows 
>in the syntax).
>
>The litmus test: you should *never* get any error messages from the 
>underlying C compiler, even when you present faulty code to the front 
>end (C++, Scheme, Dylan, Mercury, ...) compiler.  If you do then it's a 
>bug in either the front end compiler or the C compiler.

That's very true in general.

There is however one exception: if the source language allows you to
insert inline code from the target language (e.g. using `asm()' in GNU
C and many other C dialects, or using `pragma c_code' in Mercury), and
that code contains syntax errors, then the error will usually be
reported by the target language compiler (i.e. the assember, for
`asm()' in C, or the C compiler, for `pragma c_code' in Mercury)
rather than the source language compiler.  For those fragments, the
source code compiler is just passing them on to the target code
compiler unchanged.  Nevertheless I still think it would be inaccurate
to describe such translators as preprocessors: although they have a
facility for inline target code, they are still very much full
compilers rather than preprocessors.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the Python-list mailing list