This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Proposal for automatic generation of c++ header files


On Fri, Jan 14, 2011 at 4:14 PM, Robert Dewar <dewar@adacore.com> wrote:
> I guess I would just summarize things as follows. You
> can possibly generate headers automatically (just as
> you could generate subprogram specifications in Ada
> automatically).
>
> No one would ever think of suggesting doing this
> automatically in Ada.
>
> Why not? Because you might be able to generate
> the syntax of the specs, but you can never extract
> the specification from the implementation. That's
> because by its nature the implementation over-specifies.
>
> For example, if you have a sort package, the spec may
> simply require sorting, but not stable sorting.
>
> The implementation may happen to use an algorithm that
> happens to be stable.
>
> But if you have only the implementation you won't
> be able to tell if the stabilitiy is part of the
> specification.
>
> Then if you find later that you could speed things
> up hugely by abandoning the stability, you won't know
> if clients are legitimately depending on this or not.
>
> So from my narrow Ada perspective, I don't like any
> suggestion of automatic generation of c++ header
> files, but on the other hand, I understand that there
> are lots of people who have view a of headers (nuisance
> required by the compiler), and for such people it may
> ease writing to have such automatic generation. As I
> said before I never care at all about ease of writing
> code, compared to ease of reading it (and in the case
> of library packages, clients are readers).
>

There is nothing that prevents the specification code to be in the
same file as the implementation code, other than the will of the
language author.

All newer languages don't have header files...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]