thisCompiler special variable

Stephen Pair spair at advantive.com
Tue May 23 12:09:54 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

I realize the performance hit can be very minor, but it still bothers me.
Also, I'm only using debug code as an example of what's possible.  The
mechanism itself would open up a wide range of possibilities.

For example, you might want to enable the ability to use different languages
within the same class.  Pragmas such as the following could be used on a
method by method basis:

<language: #smalltalk>
<language: #prolog>
...etc.

Or, in some cases you need specialized bytecodes compiled into a
method...such as bytecodes marking an object dirty if there is an inst var
assignment.  You could do this for an entire class, but it might be useful
in some cases to use the special compiler on a method by method basis:

<compiler: #markDirty>

You might want to indicate that a method should be wrapped in a critical
section:

<critical>

A lot of the AOP weaving compiler stuff could potentially be addressed in
this way.

- Stephen







More information about the Squeak-dev mailing list