This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] type safe trees
- From: "Gabriel Dos Reis" <gdr at acm dot org>
- To: "Theodore Papadopoulo" <Theodore dot Papadopoulo at sophia dot inria dot fr>
- Cc: "gcc" <gcc at gcc dot gnu dot org>
- Date: Thu, 24 Jun 2004 03:21:02 +0200 (CEST)
- Subject: Re: [RFC] type safe trees
- References: Your message of "Wed, 23 Jun 2004 17:34:29 +0200." <37466.::ffff:24.250.169.187.1088004869.squirrel@webmail.nerim.net> <200406231705.i5NH5DGT024329@mururoa.inria.fr>
- Reply-to: gdr at acm dot org
You Wrote Theodore Papadopoulo
>
> gdr@acm.org said:
>>
>> comments?
>> So, we don't want C++, we find C too restrictive in the expressive
>> power it gives us and we end up inventing a new language we have to
>> learn?
>
>> If we were going to teach gentype a new language and use it for
>> anything, I would strongly suggest we teach it a *subset* of C++ that
>> is simple enought to get it generate the C bits we want out of it.
>
> I was feeling the same way, while reading the proposal and also the
> vector stuff earlier today (in some way it is a subset of
> std::vector<type> that is implemented)...
I agree with your message.
I think we can add the following as staring points:
(1) inheritance -- no access checking invoved.
(2) class templates -- including explicit specializations.
I'm not sure about partial specializations. I would
leave them out.
(3) function templates -- no overloads! With explicit
specializations, that helps simulate the type-generic
macros C99 introduced, without giving programmers any
way to define those.
The above could be added to the C dialects already understood
by gentype.
The above would let us get very far, provide type-safe
data-structrures; stop abusing of trees for everything.
-- Gaby
>
> While I'm certainly not entitled to raise my voice (I do not have any
> real worth contribution to gcc), as a somewhat occasional observer
> (and tweaker), it would be nice to have some syntax convergence for
> the additions to the C language corresponding to C++ constructs....
> maybe not fully perfect but at least something approaching.
>
> Thinking of it, having some kind of C++-lite preprocessor (written in C
> to be able to bootstrap the compiler!) that would take the language
> "C with the necessary added stuff from C++ and more generally all the
> useful stuff (a la GTY) needed for gcc" and would dump pure C code
> would be quite coherent and nice. I think this is the direction gcc
> is slowly taking, but people just have to realize it and make the
> additional step to do it with less preprocessor hackery and with a
> real syntax description...
>
> I understand perfectly that this is more work, though. But I believe
> that this has better long-term payoffs.
>
> Some (simple?) preprocessing might even allow the use of exceptions
> for handling errors... For types the C++ namespace syntax could be
> used (in a restricted way) as a marker: gcc::vector<type> (you detect
> gcc:: and rewrite what follows). Wouldn't that be nice...
>
> Anyway, I think it is nice to finally push some object programming
> concepts into gcc. I'll read your summit papers with a lot of interest
> as soon as I have some time.
>
>
> --------------------------------------------------------------------
> Theodore Papadopoulo
> Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
> --------------------------------------------------------------------
>
>
>