FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Array functions

 
Post new topic   Reply to topic     Forum Index -> Descent
View previous topic :: View next topic  
Author Message
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Mon Feb 04, 2008 5:20 pm    Post subject: Array functions Reply with quote

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
View user's profile Send private message
asterite



Joined: 01 Jun 2006
Posts: 235
Location: Buenos Aires, Argentina

PostPosted: Mon Feb 04, 2008 5:41 pm    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Tue Feb 05, 2008 10:47 am    Post subject: Reply with quote

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
View user's profile Send private message
asterite



Joined: 01 Jun 2006
Posts: 235
Location: Buenos Aires, Argentina

PostPosted: Tue Feb 05, 2008 11:07 am    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
asterite



Joined: 01 Jun 2006
Posts: 235
Location: Buenos Aires, Argentina

PostPosted: Tue Feb 05, 2008 11:09 am    Post subject: Reply with quote

Oh, and having phobos and tango will also give you trouble, since you'll have two "object.d" files.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Wed Feb 06, 2008 7:28 pm    Post subject: Reply with quote

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);
}


Code:
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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Descent All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group