D-etractions A real world programmers view on D
Jacob Carlborg
doob at me.com
Thu Aug 30 11:26:41 PDT 2012
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.
> Here is what I think:
>
> 1. an IDE can be built that refactors non-meta-generated code quite
> well, D is easily parsed.
> 2. Said IDE can be provided hooks so when it does encounter mixins, it
> can be told what things mean.
>
> For example, I use netbeans to write php -- a dynamic language. There
> are no real variable type declarations, so when you start typing,
> auto-complete sucks unless you have told the IDE what a variable is.
> You do so like this:
>
> /**
> @var Type
> */
> var $varname;
>
> And now the IDE assumes you have stored a Type into $varname, so when
> you type $this->varname->, it completes with the members of Type.
> Without the comment, I get nothing.
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/
> A similar approach could be taken with mixins, like bitfields. You
> identify what the parameters to the mixin are, and then the IDE can take
> appropriate actions.
>
> For things like bitfields, which are considered core language constructs
> in phobos, the IDE may actually be made more intelligent and detect this
> automatically.
>
> I don't think this is an unsolvable problem...
I think a compiler library that can lex, parse and do full semantic
analysis should be able to handle this.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list