Good day Whole Tomato developers and VAX users!
More than year and half ago I started a thread about an automatic addition of #include statements. http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=8009.
And a year later you have pulled this feature off beautifully.
This time I would like to suggest something even more awesome that could really make C++ development more like it is in Java, C# or Python (eclipse + Pydev).
I want VAX to manage my #include and using statements automatically.
I want to use a simple function, let's codename it "Organize includes" which when executed over a C++ file (for starters) will do the following:
* Find all undefined symbols in a file and add a minimal set of #include statements that define them.
* Find all includes that are not necessary for the file to compile and remove them.
* Group includes using the longest common prefix and <> or "" types.
For instance:
#include "library/vector.h"
#include <gl/gl.h>
#include "library/matrix.h"
#include <set>
#include <algorithm>
will be transformed into:
#include "library/vector.h"
#include "library/matrix.h"
#include <gl/gl.h>
#include <set>
#include <algorithm>
* It is not enough to just #include most of the symbols, in big software projects they are defined in different namespaces. So I want VAX to add the using directive for either namespace or its symbol automatically.
For instance:
vector<int> v;
After "Organize includes":
#include "library/vector.h"
using library::vector;
vector<int> v;
We would have user preferences for adding "using namespace" over adding "using namespace::specific_symbol", so that the user will have his includes managed the way his team does.
Later it should be extended to work on .h files as well.
To show you my dream vision example, this is how it'd work:
Initial file:
Shake makeMeShake()
{
Banana banana;
Knife cutter;
Mixer mixer;
Milk milk;
vector<Mixable> bananaSlices = cutter.cut(banana);
mixer.add(bananaSlices);
mixer.add(milk);
FoodMix tastiness = mixer.mix(10);
return Shake(tastiness);
}
After "Organize includes"
#include "groceries/Banana.h"
#include "groceries/Milk.h"
#include "kitchenStuff/Knife.h"
#include "kitchenStuff/Mixer.h"
#include "food/Mixable.h"
#include "food/FoodMix.h"
#include "food/Shake.h"
#include <vector>
using namespace groceries;
using namespace kitchenStuff;
using namespace food;
using std::vector;
Shake makeMeShake()
{
Banana banana;
Knife cutter;
Mixer mixer;
Milk milk;
vector<Mixable> bananaSlices = cutter.cut(banana);
mixer.add(bananaSlices);
mixer.add(milk);
FoodMix tastiness = mixer.mix(10);
return Shake(tastiness);
}
Think about it, why do we need to manage our includes, really? In 95% of the cases, I can trust software to do that.
It works in Pydev, it works in C# and it works in Java. Why do we have to suffer as C++ programmers?
This could have a tremendous value for big projects because if you can optimize includes in the .h and .cpp files, it will *dramatically* reduce the compilation time.
I don't even care for this feature to run fast, as long as it does the job.
I think as long as this feature is well customizable (so you could define your include and using directive stytle) it will truly be a dream coming true and a super worthy upgrade.
Thanks for your attention and thoughts,
Gennadiy