thisCompiler special variable

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Tue May 23 06:40:40 UTC 2000


Stephen Pair wrote:

> I really think something like this would be very useful, particularly during
> the development process...and it could also aid users of a framework who
> want the ability to debug the framework (the author could embed very
> meaningful debug pragmas into their code without fear of hindering
> performance).  This too is commonly done with C/C++ preprocessors.
> 
> - Stephen

The performance hit is very minor. A conditional byte code is much less
expensive than a single message send. So if you just write

Debug ifTrue: [self whatever]

you get all that you need with no dead weight at all. The only problem I see
is that it clutters the source code, and there asserts are no better.

> Preprocessors for C/C++ we're an afterthought in that language...and their
> implementation shows it, but that doesn't say anything about their
> utility...I can think of few C/C++ programs that don't use preprocessor
> definitions.

Yes, because you need it there--there's no other way you can do these things
in C.

I realized in my compiler implementation course that the reason there's a
preprocessor in C is that it is by far the easiest way to solve a lot of
compilation problems (for the compiler writer).

Henrik






More information about the Squeak-dev mailing list