This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] type safe trees
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: gcc at gcc dot gnu dot org
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>, gdr at acm dot org, Mark Mitchell <mark at codesourcery dot com>, Nathan Sidwell <nathan at codesourcery dot com>, zack at codesourcery dot com
- Date: 24 Jun 2004 22:34:27 -0400
- Subject: Re: [RFC] type safe trees
- References: <35125.::ffff:24.250.169.187.1088092810.squirrel@webmail.nerim.net><200406241641.i5OGfu131772@tin.geop.uc.edu><20040625013418.GA5972@disaster.jaj.com>
Phil Edwards <phil@codesourcery.com> writes:
> You're speaking facetiously as a joke, but one of the disagreements that
> keeps being raised (here and on IRC) is that if we start using any part
> of C++, even if only a "stricter C with classes," we'll inevitably start
> using more and more, ending up with a bizarre template metaprogramming
> version of reload.
>
> Can we all agree to just flat kill that stupid nonsense? It's a causal
> (not "casual") form of the slippy-slope argument, which is typically wrong.
> It implies that nobody would /notice/ if other facets of the language
> suddenly appeared in the compiler sources. It implies that we can't use
> any part of C++ without using all of it, which any decent C++ programmer
> should find a little insulting, as the language was expressly designed to
> support using only parts of it.
That's not the argument, it's the strawman. The argument is that once
we are using a subset of C++, there is a very low barrier to using
other parts of C++. Exception handling will obviously be useful in
the parser and probably other places--and we are already using C++, so
why not use exception handling? Operator overloading is obviously
useful for, e.g., bitmaps--and we are already using C++, so why not
use operator overloading? STL is obviously useful for vectors, among
other things--and we are already using C++, so why not use STL?
So sooner or later we are using everything except multiple
inheritance, and the warning option for the parts of C++ which we are
not supposed to use becomes rather less useful.
I'll add that while I think that that is what would happen, I don't
think that is necessarily bad. C++ lets you generate drastically
inefficient code much more quickly than C, but I think we have the
infrastructure to detect those problems and fix them. And I think
that C++ has clear advantages over C.
I'll repeat that if we are really going to switch languages, it would
sure be nice to switch to one which supported garbage collection,
instead of carrying around our own GC machinery. I'll admit that it's
easier to convert to C++ incrementally than it would be to any other
language.
Ian