From 5167233248092670204
X-Google-Thread: f78e5,e8e0ab29e8861265
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 27 Jul 2005 16:20:08 -0500
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Delivered-To: std-c++@ucar.edu
From: "Bob Bell" <belvis@pacbell.net>
Newsgroups: comp.std.c++
Subject: Re: If C++ had interfaces, what would they be?
Organization: http://groups.google.com
Message-ID: <1122497839.229429.320980@z14g2000cwz.googlegroups.com>
References: <dfadnU0KIovHJkbfRVn-3Q@speakeasy.net>
   <1121963458.661748.118300@f14g2000cwb.googlegroups.com>
   <HIednX0HN9sLm33fRVn-qQ@speakeasy.net>
   <1122299887.515239.317170@g49g2000cwa.googlegroups.com>
   <oaidneYkiKMP93jfRVn-hQ@speakeasy.net>
   <1122336456.595882.282330@g49g2000cwa.googlegroups.com>
   <42E60A63.9050409@cs.york.ac.uk>
   <1122409313.507177.240760@g14g2000cwa.googlegroups.com>
   <u8adnSopg7NDz3rfRVn-og@speakeasy.net>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Complaints-To: groups-abuse@google.com
User-Agent: G2/0.2
Complaints-To: groups-abuse@google.com
Injection-Info: z14g2000cwz.googlegroups.com; posting-host=160.33.20.11;
   posting-account=YkQmFgwAAADb4VCQxbKct8M2us8SA5QU
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
Date: Wed, 27 Jul 2005 16:16:17 CST
Lines: 78
NNTP-Posting-Host: 65.182.171.162
X-Trace: sv3-iEdl8s19KEOnoWW3/6ISi/MbYTraXaQUKJiPuOY4aRPmjjUX1KV0bnfhMkqG/47syyvr8R9jhHVYWRM!TTYDzQ7VfTwUvjxROYO06L5tBQWAsx6Pipdzd0Os+syeS/kbz2RKOYWQQeYPNreQ8YhhG2RCMbj9!XZNsDwDDZLfV0HQ/BxQ3ej82OQ6Gh7qy8ZYnex82MCI=
X-Complaints-To: abuse@speakeasy.net
X-DMCA-Complaints-To: abuse@speakeasy.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.32
Xref: g2news1.google.com comp.std.c++:1528

Steven T. Hatton wrote:
> Bob Bell wrote:
> > My point is that there is nothing about the language
> > definition that precludes this sort of interaction; tools can be
> > written to address this needs. One may argue that tools of this sort
> > are hard to create, and that's fair; they _are_ hard.
>
> In many cases the things we want an IDE to do for us are things we would
> otherwise do by hand.  I'm convinced that something that is difficult to
> automate is usually difficult to accomplish in the first place.
>
> I know in my experience with C++, most of my time is spent dealing with
> preprocessor, or linking related problems.  The amount of time I've spent
> actually writing code is less than the time I've spent on problems related
> to file name extensions, arcane and obscure preprocessor definition
> conflicts, and simple preprocessor macro demangling.  You can say your IDE
> will automate the location of #defines, but what happens when you are
> examining an SVN repository with a web browser?

Let me see if I can rephrase the question: "What happens if you're
using a web browser to peruse a large number of hierarchically
organized web pages, looking for some piece of information you know is
on one of the pages?" Unless the web pages have some kind of search
functionality built in to them, your only resort is brute force
searches and lucky guessing.

What has that got to do with C++?

> This is something that
> came up just yesterday for me.  I was looking at code that had the
> namespaces #defined.  Other than brute force searches, and lucky guessing,
> there is no way to properly understand the code you're looking at.
> The particular code base I'm talking about is one of the best organized C++
> projects I've seen.

So you were searching a code base using a tool that was poorly suited
for the job. How does that support the idea that C++ needs to be
changed?

I don't see the connection between difficulties associated with using a
web browser to browse code and the idea that use of the preprocessor
can lead to problems; would the situation be any different if you were
using a web browser to find an overload of a function? A template
specialization? A class definition? A free function?

> There are places where things are far worse.  Many of
> the worst examples of deranged C++ project and program structure are really
> badly written C programs with some C++ classes mixed in.  This is not to
> say C projects cannot be well organized and coherent.  I'm currently
> studying the libelf package.  For the most part, it seems quite well
> organized, and doesn't go too far into the typical C macro madness.
>
> The degree to which the Cpp is used to undermine the good order of C++ is
> one of the primary motivations I have for exploring different possible
> language directions.  Two things need to happen. 1) People need to become
> aware that Cpp programming really does cause problems.  2) alternatives
> need to be provided so that the bad practices can be replaced with better
> ones.

Don't get me wrong; I'm all for seeing the preprocessor improve. But I
don't think it's very realistic to hope that it will go away, or be
replaced by something "better". For one thing, it's just too useful;
for some of the things it does, there just isn't any better solution.
(If you haven't already, stop by www.boost.org and have a look at the
preprocessor metaprogramming library.)

As for 1), I don't have an answer for it, and in fact I agree with you;
the preprocessor needs to be used carefully. As for 2), C++ has gone to
great lengths to provide alternatives to the preprocessor.

Bob

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



