About the new compiler, Part I

John Brant brant at refactoryworkers.com
Sun Jan 20 16:34:18 UTC 2008

Paolo Bonzini wrote:

> By the way, his work led to the discovery of a couple of RBParser bugs. 
>  See http://snipurl.com/1xu6y for a c.l.s post describing them.

I thought I had replied to this, but it appears that I didn't. Anyway, 
the problem with both of these rewrites is that you are trying to 
replace a cascade message with something that isn't a message. For 
example, when you perform the '``@receiver display: ``@object' -> 
'``@object' rewrite on the following:

    (stream display: z) display: (stream display: x);
                        display: y; nextPut: $q

It first matches the "(stream display: z) display: (stream display: x)" 
expression. It then searches in the ``@receiver and ``@object for more 
matches and replaces them so after replacing the subexpressions, we get 
"``@receiver = z" and "``@object = x". Now, we return the overall 
replacement for the cascaded #display:. In this case we return the "x" 
expression. Since this is not a message, we cannot use it in a cascaded 
message, so in VW (I don't know about other implementations), we print 
an error message to the transcript and we ignore the rewrite for this 
node. The error message is "Cannot replace message node inside of 
cascaded node with non-message node."

If we allowed this bad replacement, we would essentially be transforming 
the code to:
		y; nextPut: $q
And this isn't valid Smalltalk code.

John Brant

More information about the Squeak-dev mailing list