[cfe-dev] Should we build semantically invalid nodes?
akyrtzi at gmail.com
Sun Oct 26 14:17:16 PDT 2008
Chris Lattner wrote:
> I understand that it is possible. It boils down to an engineering
> tradeoff: is it more important for refactorings to be robust and easy
> to develop, or more important to handle broken code. Further, if you
> handle broken code, how many broken cases do you handle and how do we
> distinguish between them? Refactoring in general needs full type info
> and many other things. While I understand that this case is
> conceptually simple, there are many other cases that aren't.
You can allow the simple cases and disallow the others. IDEs always
choose the tradeoff of maximum assistance to the programmer while he is
writing his code.
> Good IDEs would use simple syntactic information about (e.g.)
> namespaces etc. While it's true that you have to do full AST building
> to handle the fully general cases, the tradeoff is that you can't keep
> the index up to date as fast and it requires a bunch more memory.
> Because of this, most IDE's use a fuzzy parse that does not do AST
> building or type checking to get this info.
In this futuristic, multiple-processor, lots-a-GB, world, I don't think
we can't afford to just get all the references of a variable. What you
describe is chronically awful tool support for C++ because of its
complexity (compared e.g. to java); we can certainly improve things
here, right ?
> On Oct 26, 2008, at 12:57 PM, Argiris Kirtzidis wrote:
>> Anyway, if the consensus is that the parse tree is not important, I'll
>> shut up :-)
> To be perfectly clear, I think this was a really interesting and
> useful discussion. The only reason I'm pushing back so hard is that
> we already have lots of concrete problems to solve. I think we should
> only pursue this sort of thing in the future, if/when the lack of this
> capability is blocking something.
I'm not sure I understand whether I'm "barking at the wrong tree" or
not. My point is that the parse tree is important for IDEs in general
and refactoring in specific; not having it is "blocking" (well limiting
more accurately) this kind of uses ("find me all references of 'foo'").
It's one thing to say that "the parse tree is important for this stuff
and we'll get to it in the future", and another that "I don't think
having the parse tree makes a difference to anything, but if we find
some use for it in the future we'll consider it".
So which exactly is it ?
More information about the cfe-dev