🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2922

Re: stop adding keywords to C++

#2922
From: Tim Hollebeek
Date: Wed, 13 Dec 1995 17:55
52 lines
3295 bytes
In article <MATT.95Dec13025435@Austern>,
Matt Austern <matt@physics.berkeley.edu> wrote:
>In article <4alt1o$13a2@news.ccit.arizona.edu> jychen@aruba.ccit.arizona.edu (Joseph Y Chen) writes:
>
>> I have not objection to boolean type.  But those added key words like 
>> and, or, xor, etc,  just make C/C++ awful, reminding me of Basic which 
>> has far too many key wods.  I agree that people using C/C++ aren't fools 
>> and they don't need those added key words.
>
>People using C++ aren't necessarily fools; also, though, they aren't
>necessarily Americans.  The alternative tokens (which aren't quite the
>same as keywords) were added to C++ because some C++ operators use
>characters that exist in ASCII but not in other national character
>sets.
>
>Alternative tokens, in other words, solve the same problem that
>trigraphs do.  Personally, though, I think that alternative 
>tokens are a much nicer solution.  I'd much rather read an 
>expression like "i < 0 or i >= n" than one like "i < 0 ??!??! i >= n".

I disagree.  In C++, already, identifiers are highly overloaded, since
there is nothing to distinguish typenames from variables (and, of
course, globals/locals/member variables aren't distinguished either).
Secondly, the C++ syntax is such that it is difficult to tell at first
glance the difference between an expression and a declaration,
especially since they can be freely intermixed.

something_or_other name = some < nasty_expression;
something_or_other_name = some < nasty_expression;

This is especially true when using templates, when the typename can be
rather complex itself.  In C++, it is important to have a style which
makes these things easy to pick out, or your code is hard to read.
Personally, I capitalize types, and tab declarations so they stand out:

SomethingOrOther 		name 		= some < nasty_expression;
something_or_other_name = some < nasty_expression;

Now back to the issue at hand.  Having lots of keywords makes this
problem even worse, unless you have an editor that can highlight them
automatically for you.  The are simply too hard to pick out by eye.
&& is much easier to see and recognize than 'and' is.

-- 
Tim Hollebeek      | Everything above is a true statement, for sufficiently
PChem Grad Student | false values of true.
Princeton Univ.    | tim@wfn-shop.princeton.edu
-------------------| http://wfn-shop.princeton.edu/~tim

[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <4an1nq$5s0@cnn.Princeton.EDU>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
References: <Pine.SOL.3.91.951203010216.13007A-100000@barney> <4a12d7$vps@mujibur.inmind.com> <4alt1o$13a2@news.ccit.arizona.edu> <MATT.95Dec13025435@Austern>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: tim@franck.Princeton.EDU (Tim Hollebeek)
Newsgroups: comp.std.c++
Subject: Re: stop adding keywords to C++
Date: 13 Dec 1995 17:55:57 GMT
Organization: Princeton University
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <4an1nq$5s0@cnn.Princeton.EDU>
References: <Pine.SOL.3.91.951203010216.13007A-100000@barney> <4a12d7$vps@mujibur.inmind.com> <4alt1o$13a2@news.ccit.arizona.edu> <MATT.95Dec13025435@Austern>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
X-Nntp-Posting-Host: franck.princeton.edu
Content-Length: 2381
X-Lines: 48
Originator: clamage@taumet