On 10 November 2011 10:58, Basile Starynkevitch wrote:
> With the type inference abilities given by
> the auto keyword, it is sometimes hard for a beginner to understand what type 
> is some
> particular expression in his code (or what exactly function is called in an 
> overloaded
> context).

If 'auto' obfuscates the code don't use it, and if overloaded
functions don't do the same thing for different argument types then
they should be renamed.

If I call advance(iter, 4) I don't want to know that it called the
specialization of std::advance<std::vector<X>::iterator> because all I
care is that it calls the appropriate specialization, which it will
automatically.

Eventually I'm going to come back to this idea, but I want that for
debugging template libraries, not for interactive use in an IDE:
http://gcc.gnu.org/ml/gcc/2011-06/msg00110.html

> The type annotation file can be generated by C++ front-end, and would contain
> type and position information for every expression inside a source file.
>
> That type annotation produced by g++ would be usable by external editors, etc.

That's a pretty big assumption, and the file would be useless without
editor support (I realise there's a chicken and egg situation here.)

Doesn't DWARF debug info already contain all that info anyway?

> Of course, such a thing could be done by some GCC plugin, but I believe 
> providing the
> feature inside GCC itself, and documenting the format of the textual type 
> annotation
> file, would give this feature more visibility, and it would help people a 
> lot. And I am
> pretty certain that the C++ frontend does compute the type of each 
> expression, so it is
> mostly the point of defining a textual type annotation format and output it.

What's the point of plugins if they aren't used to do this sort of thing?

Reply via email to