CodeCompass icon indicating copy to clipboard operation
CodeCompass copied to clipboard

Type name or function name?

Open bruntib opened this issue 5 years ago • 4 comments

Let's consider the following code fragment:

class C {
  C(int) {}
};
int main() {
  C* c = new C(42);
}

What should we display when clicking on symbol C after new keyword? Is this the C class or the constructor function? Currently we store both symbols at this position and this is sort of random which one is displayed. Years ago we tried a weird solution: clicking on C means the type and clicking on the parentheses means the construction function. I wouldn't choose this solution, because it is not really intuitive. We should find an elegant GUI solution for presenting both somehow.

bruntib avatar Aug 03 '20 19:08 bruntib

Good catch!

Let us collect usage samples, like:

C *cp = new C(42); throw C; // if clicking on C jumps to constructor, this is different, than the one in next line throw C{42} assert ( 4 == sizeof(C) ) // similarly declval(C) -> which constructor?

bruntib [email protected] ezt írta (időpont: 2020. aug. 3., H, 21:43):

Let's consider the following code fragment:

class C { C(int) {} };int main() { C* c = new C(42); }

What should we display when clicking on symbol C after new keyword? Is this the C class or the constructor function. Currently we store both symbols at this position and this is sort of random which one is displayed. Years ago we tried a weird solution: clicking on C means the type and clicking on the parentheses means the construction function. I wouldn't choose this solution, because it is not really intuitive. We should find an elegant GUI solution for presenting both somehow.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Ericsson/CodeCompass/issues/421, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTPLCHC563J7AAQPFMKNILR64HN3ANCNFSM4PTVBQCA .

zporky avatar Aug 03 '20 20:08 zporky

declval<C>() is not a constructor call. In that context, C should be the type name.

whisperity avatar Aug 04 '20 08:08 whisperity

Yes, declval is an example when we use typename. Similar to "use" and "typedef" occurrencies.

Whisperity [email protected] ezt írta (időpont: 2020. aug. 4., K, 10:55):

declval<C>() is not a constructor call. In that context, C should be the type name.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Ericsson/CodeCompass/issues/421#issuecomment-668473353, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTPLCFEPHXEZ2ZYOKDGKIDR67EJPANCNFSM4PTVBQCA .

zporky avatar Aug 04 '20 09:08 zporky

This issue is linked to #306 .

intjftw avatar Oct 21 '20 16:10 intjftw