Author thomaslee
Recipients nnorwitz, novalis_dt, rhettinger, thomaslee
Date 2008-11-07.07:34:47
SpamBayes Score 1.47292e-10
Marked as misclassified No
Message-id <1226043293.31.0.328876681641.issue4264@psf.upfronthosting.co.za>
In-reply-to
Content
Neal said:
> I was surprised to see the change to the AST, but I understand why you
did it.

The problems David ran into here sound like an argument for arbitrary
AST annotations -- an idea that I was toying with around the time
"Const" was introduced. That way the optimizer could provide "hints"
rather than explicitly manipulating the AST in certain cases. The
compiler could then look for those hints and generate code accordingly.

For example, in place of the Const node, we might have a "const"
annotation that's applied to the top-level expression.

I think I went with the Const node because it was less work, but I don't
remember the details. I'll try to dig up the appropriate emails if I
haven't lost them.

David said:
> Fixed, I think.  The original code appears to be somewhat 
> inconsistent between files in its uses of spaces/tabs, ...

Yes, they are inconsistent with tabs/spaces. And it sucks. :)

> The thing that struck me as ugly was the idea that there's one
> object (the optimizer) that knows everything about all
> optimization operations.

That's right, but this is no different from the compiler. Conversely, a
visitor pattern would probably work for both the optimizer and the compiler.

Having said that, I couldn't justify making the AST optimizer a huge
departure from the rest of the code base for the sake of design purity.
I'm not even really sure that it's "design purity" when you do things
inconsistently from one component to the next.

Obviously if there's another sufficiently good argument for the visitor
approach, I'm all ears. But again, if we do that I think we should do it
for the compiler as well. I'm not sure how much support such a change
would have.
History
Date User Action Args
2008-11-07 07:34:54thomasleesetrecipients: + thomaslee, nnorwitz, rhettinger, novalis_dt
2008-11-07 07:34:53thomasleesetmessageid: <1226043293.31.0.328876681641.issue4264@psf.upfronthosting.co.za>
2008-11-07 07:34:51thomasleelinkissue4264 messages
2008-11-07 07:34:48thomasleecreate