From 5230989359850869494
X-Google-Thread: f78e5,860edfd5ffaa1c7d,start
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news3.google.com!news.glorb.com!newsfeed.stueberl.de!newsfeed.vmunix.org!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: verec@mac.com (verec)
Newsgroups: comp.std.c++
Subject: C++ naming ... a wide subject
Date: Mon, 27 Jun 2005 22:50:11 GMT
Lines: 74
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <42c07be7$0$38043$5a6aecb4@news.aaisp.net.uk>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.demon.co.uk 1119912677 253 158.152.254.254 (27 Jun 2005 22:51:17 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Mon, 27 Jun 2005 22:51:17 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Unison/1.6.1
X-Greylisting: NO DELAY (Relay+Sender autoqualified);
	processed by UCSD_GL-v1.2 on mailbox7.ucsd.edu;
	Mon, 27 June 2005 15:23:32 -0700 (PDT)
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id j5RMoB7m000616;
	Tue, 28 Jun 2005 08:50:11 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-NNTP-Posting-Date: 27 Jun 2005 22:21:29 GMT
X-Delivered-To: std-c++@ucar.edu
X-Spamscanner: mailbox7.ucsd.edu  (v1.6 Apr  6 2005 07:48:50, -2.8/5.0 3.0.0)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
X-MailScanner: PASSED (v1.2.8 86167 j5RMLU0L088640 mailbox7.ucsd.edu)
Xref: g2news1.google.com comp.std.c++:5270

So, somehwere in the mid 90's, C++ introduced a host of new features
and hence, associated keywords.

- We'd like to be able to manipulate types. So types must have some
  kind of IDentification.
- So what about: typeId?
- Nope, that's too "Java"-esque.
- So let's agree on type_id then...
- tss! tss! typeid it is, and it should be!


- Oh wait, to play with templates and refer to builtin types
  we need to be able to say something other than template <class X>
  because, then, how could we deal with, e.g, 'int's?
- Yes, we want to refer to the name of type, what about typeName?
- Nope, that's too "Java"-esque.
- So let's agree on type_name then...
- tss! tss! typename it is, and it should be!


- Aha! But (this cast) is too ugly and overloaded. We need to
  distinguish the various use cases: static, dynamic, const and
  reinterpret.
- Oh! I get it this time! It's not going to be either of
  dynamicCast or dynamic_cast (you just popooed my earlier
  suggestions along those lines) so dynamiccast, staticcast,
  constcast and reinterpretcast it will be! I'm so glad I got
  it right this time!
- tss! tss! dynanic_cast, static_cast, reinterpret_cast and
  const_cast it is, and id should be!

It might be interesting to note that, when confronted to a
problem similar to C++ dynamic_cast naming, eg:

    if (Foo * f = dynanic_cast<Foo *)(x)) {
        // f is a Foo * or derives from Foo
    } else {
        std::cout << "Not a Foo!" << std::endl ;
    }

Java's James Gosling came up with

    if (f instanceof Foo) {
    }

Not ``instance_of'', nor ``instanceOf'', probaly because, even
though a bit weird at first, it meshed nicely with the _rest of
the language_

.

But who needs naming consistency, after all? Poets and dreamers,
certainly, not computer programmers! They've got a real product
to deliver...

It will no doubt take decades to sink in, that when one plays
with language, one plays with ideas, forms and relations,
irrespective of the proof (the program runs). Mathematicians
have been on this road for centuries, and still are, even if
"theorem proving code" is starting to appear, because you see,
_proving_ the code is the easy part ... coming up with the idea
first, _is_ the hard part. Where we need most imagination and
less impediments, inconsitencies being a major one...

My 2p :)
--
JFB

---
[ 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                       ]



