GCC 5 & modularity

Robert Dewar dewar@adacore.com
Sun Mar 18 17:11:00 GMT 2012


On 3/18/2012 12:56 PM, Basile Starynkevitch wrote:

>     * you can name and count the modules of a software

Well in a hierarchical system this is not so clear, since modules may
exist at different levels of abstraction. For instance in a compiler,
at one level of abstraction, the front end is a module, at another
level of abstraction, e.g. in the compiler, the semantic analysis for
chapter 7 constructs in the RM could be considered as a module.
>
>     * given a source line, or function, you can decide at a glance to which one module it
> belongs

This seems totally bogus, if you have something like

     n++;

you can't tell what module that belongs to, and if your idea is that
all variables should be long enough to know immediately what module
something is in, I would regard that as plain horrible and highly
undesirable.
>
>     * the interface between modules is well documented

Sure that's apple pie and motherhood, so it says nothing
>
> I'm sorry to say that, but current GCC (ie 4.7 or today's trunk) is *not* modular.

Modularity is not a binary quality, so this is not a helpful statement

> Don't
> feel injured by that fact. Indeed, GCC is a little less messy than it was a few years
> ago, but being less messy is not being modular IMHO. And something cannot be
> "half-modular".

Absolutely it can, parts of the system can be arranged nicely into 
modules, and parts of the system may not be.

> So I would be delighted if GCC was made of modules. But I have no idea of how that can be
> done.

Then your comments are not at all helpful, since they just
reflect vague goals which everyone agrees on.

> I do believe that identifiers in GCC should be organized in such a way that the module
> they belong to is visible at once. I think that a prefix (à la GTK) or a C++ namespace
> should be great. In particular, this means that most GCC identifiers should change
> (which means that any such evolution is not syntactically gradual; it has to be made by
> huge, but "easy", patches).

I am of the opinion that this would severely damage readability, it's 
the same sort of thing that leads people in Ada to avoid use clauses
completely.

Since in any decent IDE it's just a single click to find out where a 
variable is declared, it's just noise to include this information in
every variable name. Of course global variables with wide visibility
should have appropriate names, but the idea that all identifiers
should be prefixed is horrible IMO



More information about the Gcc mailing list