View previous topic :: View next topic |
Author |
Message |
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Mon Feb 04, 2008 5:20 pm Post subject: Array functions |
|
|
I've just started using the new descent 0.5, great work.
I've noticed that if you have a function that looks like this:
Code: | void foo (int[], int i) {} |
And then if you use it like this:
Code: | int[] arr;
arr.foo(9); |
then not many of the features available are working. Like Ddoc view, go to definition, auto completion and so on. |
|
Back to top |
|
|
asterite
Joined: 01 Jun 2006 Posts: 235 Location: Buenos Aires, Argentina
|
Posted: Mon Feb 04, 2008 5:41 pm Post subject: |
|
|
First of all: wow. I didn't know you could do that with arrays (I though it only worked with one argument functions).
Umm... It's working for me, though. Do you mean it doesn't autocomplete that function for you? It won't, that's not implemented. But if I write that and hover over the function call, I can see it's ddoc, and "go to definition" works. If I continue typing below, autocompletion and the other features still work.
I'm using this code to test it:
Code: | /**
* Some property.
*/
void foo(int[], int i) {
}
void blah() {
int[] arr;
arr.foo(9);
}
|
|
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Tue Feb 05, 2008 10:47 am Post subject: |
|
|
I tried a smaller test and then it worked with ddoc and go to definition. It seems that sometimes it don't work, when I don't have the include directory of tango in "Compiler system library" it don't work. If I have both phobo's and tango's include directory in "Compiler system library" then it don't work when I use "string". It almost seems like it's a random behavior. |
|
Back to top |
|
|
asterite
Joined: 01 Jun 2006 Posts: 235 Location: Buenos Aires, Argentina
|
Posted: Tue Feb 05, 2008 11:07 am Post subject: |
|
|
If you don't have any standard library in the include path, semantic analysis will stop right after it can't find "object.d", and class object, etc. So no feature will work. That's probably it.
Well, it will work if you don't use classes in your source file, but as soon as you introduce one, semantic analysis is halted. Could you check that this is what's happening? |
|
Back to top |
|
|
asterite
Joined: 01 Jun 2006 Posts: 235 Location: Buenos Aires, Argentina
|
Posted: Tue Feb 05, 2008 11:09 am Post subject: |
|
|
Oh, and having phobos and tango will also give you trouble, since you'll have two "object.d" files. |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Wed Feb 06, 2008 7:28 pm Post subject: |
|
|
It's very hard to try to figure out what's happening because it's seems to be so random. Now I'm trying this:
Code: | module asd;
import mambo.io;
import mambo.collection.array;
void foobar ()
{
int[] arr;
//println(2);
//remove(arr, 9);
arr.remove(9);
} |
ddoc and "go to definition" are working here but not if I uncomment any of the above lines. It's the same if I have Phobos, Tango or both in "Compiler system library".
BTW code completion doesn't work in this example with the functions in "mambo.io" or "mambo.collection.array", but with functions from Tango and Phobos. "mambo.*" is a library in another project referenced by this project.
Some of the functions in "mambo.*" are auto completed if I put the directory in "Compiler system library" but not all.
There seems not be any problem with classes, if I put a class in "mambo.*" the code completion doesn't work (but ddoc and "go to definition" do) for the class name but all works for the content of the class.
But you have right, using both Phobos and Tango cause problems with classes. But again it seems random. |
|
Back to top |
|
|
|