Distinguishing between "instance of class" and "class" types in the duchain

Sven Brauch svenbrauch at googlemail.com
Sun Apr 15 19:10:29 UTC 2012


Hi there,

okay, will try. Thanks :)

Cheers

Am 15. April 2012 16:48 schrieb David Nolden <zwabel at googlemail.com>:
> In C++ such distinguishment is not required. You could simply put a
> modifier on the type, eg. AbstractType::LanguageSpecificModifier, to
> distinguish instances from classes.
>
> Am 10. April 2012 15:11 schrieb Milian Wolff <mail at milianw.de>:
>> On Monday 09 April 2012 23:37:03 Sven Brauch wrote:
>>> Hi there,
>>>
>>> consider this code:
>>>   class my_class(): pass
>>
>> ClassDeclaration -> StructureType
>>
>>>   copy_of_my_class = my_class
>>
>> AliasDeclaration -> StructureType
>>
>>>   instance_of_my_class = my_class()
>>
>> Declaration -> StructureType
>>
>>> How could you find out which of instance_of_my_class or
>>> copy_of_my_class are the class itself or instances of the class now? I
>>> mean, both have the "raw" structuretype assigned, no?
>>
>> See above? The type is not saying anything about the declaration kind.
>>
>>> Am 9. April 2012 23:02 schrieb Milian Wolff <mail at milianw.de>:
>>> > On Monday 09 April 2012 22:32:02 Sven Brauch wrote:
>>> >> Hello there,
>>> >>
>>> >> there's something I'm unsure about how to correctly represent it in
>>> >> the duchain: the difference between "class" and "instance of a class".
>>> >> My current solution is that a class declaration creates a structure
>>> >> type, and if I want to reference the class itself (not an instance of
>>> >> the class) I create an alias declaration which aliases the class
>>> >> declaration. That is not really optimal for several reasons tough:
>>> >> there's always the need to search for declarations if you work with
>>> >> types, e.g. if handling an assignment, you cannot simply assign B the
>>> >> type of A, but you have to check if A is a class or an instance of a
>>> >> class, then create an alias declaration or something else depending on
>>> >> that... etc; additionaly, it's not possible to store class types in
>>> >> unsure types that way (a declaration cannot have an unsure type which
>>> >> could either be a class or None, or similar).
>>> >>
>>> >> Is there a good way to do this?
>>> >> Is there a good *idea* which I could implement in the duchain to solve
>>> >> this problem? It's really messy right now.
>>> >
>>> > In PHP and C++ we just assign the "raw" structuretype to instances. To
>>> > figure out if you actually have a declaration, you can either cast to
>>> > ClassDeclaration or compare the declaration of the structuretype. Why does
>>> > that not work for you?
>>> >
>>> > bye
>>> >
>>> > --
>>> > Milian Wolff
>>> > mail at milianw.de
>>> > http://milianw.de
>>> > --
>>> > KDevelop-devel mailing list
>>> > KDevelop-devel at kdevelop.org
>>> > https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
>> --
>> Milian Wolff
>> mail at milianw.de
>> http://milianw.de
>>
>> --
>> KDevelop-devel mailing list
>> KDevelop-devel at kdevelop.org
>> https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
>>
>
>
>
> --
> David Nolden
> nolden at i6.informatik.rwth-aachen.de
> Tel.: +49 241 80 21602
> Lehrstuhl f.  Informatik 6    RWTH Aachen University, 52056 Aachen, Germany
> Human Language Technology and Pattern Recognition
>
> --
> KDevelop-devel mailing list
> KDevelop-devel at kdevelop.org
> https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel




More information about the KDevelop-devel mailing list