[RFC] unifying gfc_symbol and gfc_component

Paul Richard Thomas paul.richard.thomas@gmail.com
Mon Nov 14 21:33:00 GMT 2016


Dear Fritz,

To be honest, I am very skeptical about this - perhaps I am too long
in the tooth?

'Entities' have a very specific place in the fortran nomenclature and
are represented by gfc_symbols. Components are not entities. I don't
say this because of what you have called the base type but rather I
would need a demonstration that is eliminating duplicated code you
don't wind up complexifying the code that has to distinguish the two.

In general terms, had gfortran been written in C++ from the outset, it
probably would have been much more concise. However, it would likely
not have attracted the support of voluntary maintainers over the
years, who have by and large needed specific features or to fix bugs
in order to achieve what they need to do. If we start down this road,
we will wind up with a horrible hybrid that will make gfortran even
more difficult to maintain. It is already enough that these hard
working maintainers have had different styles and different approaches
so that much of the code is distinctly flaky. Just take a look at
gfc_trans_procedure_call as an example of what I mean.

Just a thought.

Cheers

Paul

On 14 November 2016 at 17:35, Fritz Reese <fritzoreese@gmail.com> wrote:
> Resending as plaintext.
>
> On Nov 14, 2016 06:43, "Janus Weil" <janus@gcc.gnu.org> wrote:
> ...
>> Now that C++ is officially the implementation language of GCC (and
>> thus gfortran), it is actually very simple to implement the above
>> idea: One can just introduce a common base type (I'll call it
>> gfc_entity for now, but that name is debatable of course), and make
>> gfc_symbol and gfc_component inherit from that common base type.
>>
>> Attached is a patch which does that with just very few changes and
>> compiles and regtests cleanly. This is just a first draft. One could
>> certainly share more properties if one accepts slight naming changes
>> (e.g. locus etc). Also the patch does not make any use of the new
>> possibilities yet.
>>
>> Before I continue with that, I'd like to know what others think about
>> this idea. Do you think this is useful, or could it cause any harm?
>>
>> Cheers,
>> Janus
>
> I for one am generally excited about taking advantage of new features.
> I think the patch looks good and see no harm done. In fact I think
> locus should be shared too.
>
> ---
> Fritz Reese



-- 
The difference between genius and stupidity is; genius has its limits.

Albert Einstein



More information about the Fortran mailing list