[MonoDevelop] PATCH: More detailed generic paramters for code completion

Matej Urbas matej.urbas at gmail.com
Mon Jun 12 15:21:19 EDT 2006


Alejandro Serrano wrote:
> I don't understand very well the information in GenericArgument.
The generic argument is an actual parameter to a generic type (e.g.: 
MyClass<String> myObj <-- here 'String' is a generic argument). I will 
try to explain below why this is needed.
> I think it is better to rework IReturnType to have an  IClass inside 
> it. IClass would have the information about generic parameters (as it 
> is done in Reflection), also in form of IClass. In IReturnType I see 
> the lack of having plain generic types, that would be mended if we use 
> a Reflection-like model.
Yes, I too was considering to change StringCollections into collections 
that take references to actual parsed types (like IClass et al). That 
would be great! But the biggest problem I see is that the user can 
change the name of any type he wants at any time. Here's an example of 
what I want to point out:

Suppose we have parsed a file BaseClass.cs:

public class BaseClass
{
}

Obviously, the 'BaseClass' will be represented by an instance of 
'IClass' in our code completion database.

Now, in another file (say ChildClass.cs), we subclass 'BaseClass':

public class ChildClass : BaseClass
{
}

Here, 'ChildClass' will have the 'BaseClass' IClass in its collection of 
base types.

Now, consider what will happen if we change the name of 'BaseClass' in 
'BaseClass.cs' to 'OtherClass'. What should happen? You must know that 
ChildClass still extends a class with the name 'BaseClass' - altough no 
such class exists. However, ChildClass will still think it inherits from 
BaseClass and will hence inherit all of its members. Should we warn the 
user? Should we automatically rename all references to BaseClass?

What should we do? We may change all those string collections to 
references to actual types - we will surely improve performance and 
reduce memory usage with it! But what will happen when a namespace 
changes, or when the name of a class changes?

You must know that I still don't have enough insight into parsing and 
code completion in MonoDevelop. You should consider this post as a 
QUESTION and not as a warning.

I hope I was clear enough.

---
Matt


More information about the Monodevelop-list mailing list