View mode: basic / threaded / horizontal-split · Log in · Help
August 30, 2012
Re: D-etractions A real world programmers view on D
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
August 30, 2012
Re: D-etractions A real world programmers view on D
On Thu, 30 Aug 2012 14:26:41 -0400, Jacob Carlborg <doob@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
August 30, 2012
Re: D-etractions A real world programmers view on D
On 2012-08-30 21:00, Steven Schveighoffer wrote:

> 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.

Oh, yeah, that would be a bit complicated :)

-- 
/Jacob Carlborg
August 30, 2012
Re: D-etractions A real world programmers view on D
On Thursday, 30 August 2012 at 17:52:27 UTC, Steven Schveighoffer 
wrote:
> An interesting point of view, and I can see how paying someone 
> could be misconstrued.  If Walter was given money to hire 
> people, and he hired certain already-active members of the 
> community, it might leave some thinking "why them and not me?"  
> One thing I think would pose a large dilemma is who do you pay?

> Someone who is very active in contributing to D may not be able 
> to contribute more, simply because there are just so many hours 
> in a day.  I'm amazed sometimes as to how some people do so 
> much work on D!  This means we're just handing out bonuses 
> without getting much back.

 In my view this has very little to do with money, it has to do 
with time. Most likely most of us are freelancers or doing 
something that isn't getting us some 60k a year (or more) jobs, 
and although some of us likely are more skilled and able to take 
those jobs, the economy prevents to a degree.

 I would see the donations being used to hire someone NOT as a 
bonus or as incentive, but to allow them to tell their work place 
"hey I'll be taking a month off". If they love programming they 
may very well give more than their $15-$20/hr (or whatever is 
decided) wage they are accepting for the work; I know I certainly 
would.
August 31, 2012
Re: D-etractions A real world programmers view on D
On Thursday, 30 August 2012 at 19:00:58 UTC, Steven Schveighoffer 
wrote:
> 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 don't understand why that should be so difficult...

Why can't the IDE just scan all the #include dependencies in an 
internal database, and update them accordingly?
August 31, 2012
Re: D-etractions A real world programmers view on D
On 2012-08-31 06:54, Mehrdad wrote:

> Why can't the IDE just scan all the #include dependencies in an internal
> database, and update them accordingly?

Say you're building a library and you're currently editing one of the 
header files. You have know idea where that file can be used in the 
future. There's possible that the file isn't used at all in the library, 
i.e. no file includes it.

-- 
/Jacob Carlborg
August 31, 2012
Re: D-etractions A real world programmers view on D
On 2012-08-30 21:00, Steven Schveighoffer wrote:

> 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.

There's no possible why to know that. So when you're editing a 
particular header file it will only know about which other files it 
includes. It would be possible to detect if "A" is defined in a file 
that is included by x.h but not the other way around.

-- 
/Jacob Carlborg
August 31, 2012
Re: D-etractions A real world programmers view on D
On Friday, 31 August 2012 at 06:30:04 UTC, Jacob Carlborg wrote:
> On 2012-08-31 06:54, Mehrdad wrote:
>
>> Why can't the IDE just scan all the #include dependencies in 
>> an internal
>> database, and update them accordingly?
>
> Say you're building a library and you're currently editing one 
> of the header files. You have know idea where that file can be 
> used in the future.


Huh? Who is trying to predict the future?

We're talking about the C/C++ macro example here, with _existing_ 
code in the _same_ project...
August 31, 2012
Re: D-etractions A real world programmers view on D
On 2012-08-31 09:14, Mehrdad wrote:

> Huh? Who is trying to predict the future?
>
> We're talking about the C/C++ macro example here, with _existing_ code
> in the _same_ project...

If you limit yourself to the existing project that's very different. I 
would like to have autocompletion across project boundaries.

-- 
/Jacob Carlborg
August 31, 2012
Re: D-etractions A real world programmers view on D
On Fri, 31 Aug 2012 00:54:07 -0400, Mehrdad <wfunction@hotmail.com> wrote:

> On Thursday, 30 August 2012 at 19:00:58 UTC, Steven Schveighoffer wrote:
>> 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 don't understand why that should be so difficult...
>
> Why can't the IDE just scan all the #include dependencies in an internal  
> database, and update them accordingly?

a.c:

#define A
#include "x.h"

b.c:

#include "x.h"

Now, depending on whether you are editing x.h in terms of a.c or b.c, the  
#ifdef is active or not.  The IDE will be wrong no matter what choice it  
makes.

This is why I like how external definitions and imports cannot affect D  
modules.

-Steve
2 3 4 5 6 7 8 9 10
Top | Discussion index | About this forum | D home