D-etractions A real world programmers view on D
Steven Schveighoffer
schveiguy at yahoo.com
Thu Aug 30 12:00:58 PDT 2012
On Thu, 30 Aug 2012 14:26:41 -0400, Jacob Carlborg <doob at me.com> wrote:
> On 2012-08-30 15:35, Steven Schveighoffer wrote:
>
>> Not any that I have used. In fact, in one project that I was working
>> from an existing code base, I had to configure Visual Studio 2010 to NOT
>> fade out what it thought was commented code, because it was wrong.
>> Otherwise, it was too distracting.
>
> As I replied to Walter's post, any IDE based on Clang should be able to
> handle this. Xcode 4 has Clang integrate from the start, There's a
> plugin for Sublime Text and I'm pretty sure there's a plugin for vim.
I don't think the problem is solvable with CPP, because it's not always
possible to know how it's included.
For example, if I have a file x.h which does:
#ifdef A
#define B
#endif
And I edit x.h, how does it know the original source file which includes
x.h does or doesn't define A before including x.h? That is the issue I
was having.
I suppose you could refactor any C or C++ source files, but not header
files (and most variables/members are defined in header files).
Like the D problem though, there is certainly some level of confidence you
can have when refactoring if things aren't dependent on #ifdefs. But I
wouldn't want to write that code :)
> I've tried RubyMine with Ruby on Rails. It worked surprisingly well
> without needing to add extra comments. It knows the actual types of the
> variables and can provide accurate autocompletion in most cases. When
> I'm saying this you should know that there are many methods in Rails
> that are generated dynamically or uses method_missing (opDispatch).
>
> The same company have made an IDE for PHP as well, you might what to
> give it a try:
>
> http://www.jetbrains.com/phpstorm/
Thanks, I will look at it. Netbeans does do a pretty good job knowing
when you have previously assigned a variable that it is of that type, but
there are pieces that cause it to give up, like if the variable comes as a
parameter to a function, or is not assigned in the file you are editing,
or it is put into an array (that last one I really hate).
> I think a compiler library that can lex, parse and do full semantic
> analysis should be able to handle this.
I think so too. And even if it's not perfect, as long as it can *tell*
when it's not possible, that is OK.
-Steve
More information about the Digitalmars-d
mailing list