thisCompiler special variable

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Wed May 24 20:29:00 UTC 2000


Stephen Pair wrote:

> 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.

I should've written, *very very* minor...

> 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.

This actually works already--you can put Prolog queries in a regular
Smalltalk method.


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

Since you bring this up :) ... I was about to say, what you _really_ want is
full partial evaluation, which tries to evaluate the code in a method at
compile time, and substitute the results for the evaluated message. Thus
"Debug ifTrue: [xxx]" would be transformed into just xxx or nothing at all
depending on the value of Debug (but this is just the beginning). Your [1+1]
example would be a piece of cake for it--you don't even have to mark it in
the source code.

...I am currently using such a partial evaluator for my AOP weaver. That's
why I wrote it. Let me know if you'd like to test drive it.

Stephan Rudlof wrote:

> Idea: It should be possible to introduce a browser mode, which hides
> assertions, though, to avoid seeing the cluttering of the source code.
> 
> Stephan

Partial evaluation: set Debug to false, and tell it show the evaluated
version of the source. This is how I generate the woven aspect code in the
browser from the various aspect snippets.

Regarding breakpoints, I imagined a special #breakpoint message which was
inserted programmatically and wasn't shown by the decompiler/debugger etc.,
except as a tiny red stop sign or something. But I guess there'd be some
unpleasant issues with that, which presumably only Dan would want to take
on, so it never got past my inner drawing board. I've already tried to make
the debugger more clever when stepping into a block, and it's not all that
trivial to do a complete solution.

Henrik






More information about the Squeak-dev mailing list