Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Anti-rust programming language

Reply
Thread Tools

Anti-rust programming language

 
 
ToM_tOm
Guest
Posts: n/a
 
      09-18-2005

I've been programming in C++ for a few years now. At one stage, I had a
great deal of it very fresh in my mind.

About two weeks ago, I started back programming in C++ having not been at it
for maybe a year. I opened a few of my old source files and was... well...
unfamiliar!

Looking at "p_k = &k" and the like left me staring blankly at the screen
trying to think exactly what that meant... ?

A day later I was grand, I had the syntax down.

But... I realised something about the C++ programming language. I'll try to
keep this objective, as I'm sure a few of you here would object to any
suggestion that this is a "flaw" in the language, but here goes:

C++ is not at all "anti-rust". By that, I mean that it's very easy to become
rusty at it, and once you do, you're perplexed looking at all the strange
syntax!

Compare this to Visual Basic. If you could do something like "p_k = &k" in
VB, then it'd probably look like:

SetPointer p_k = AddressOf( k )

, which we English speaking humans can understand very easily!

I'm not all suggesting that the language should be dumbed-downed or
deficienized (as is the case with VB), but I think it would be helpful if
actual English words were used in the place of symbols.

Don't get me wrong though -- I'm a fairly intelligent person and I've no
problem at all reading through a source file looking at all the different
symbols; I can interpret them swiftly on-the-fly, but if I go twelve months
without seeing them, then they're just unfamiliar alien language.

The whole "alien language" aspect is what makes C++ so daunting for
beginners. To a person who doesn't know C++, or who is rusty, a C++ source
code file looks like horribly complex gobledygook! Little do they know
though that we C++ programmers read through it as easy as our native
language... just so long as we're not rusty!

Anyway, I've said enough. I'm summarise:

Because we use symbols in C++, if we go a good deal of time without using
it, we become horribly rusty.

If we were to use actual English words instead of symbols (as does Visual
Basic), then the language would be learned more quickly, and also we
wouldn't spend as much time digging into the back of our brain once we
become rusty.

Maybe someone out there has made a parser to change symbols into words and
vice versa?

ToM_tOm
 
Reply With Quote
 
 
 
 
Ian
Guest
Posts: n/a
 
      09-18-2005
>
> Compare this to Visual Basic. If you could do something like "p_k = &k" in
> VB, then it'd probably look like:
>
> SetPointer p_k = AddressOf( k )
>

#define SetPointer
#define AddressOf( n ) &##n;

Ian
 
Reply With Quote
 
 
 
 
Walter Bright
Guest
Posts: n/a
 
      09-18-2005

"Ian" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> >
> > Compare this to Visual Basic. If you could do something like "p_k = &k"

in
> > VB, then it'd probably look like:
> >
> > SetPointer p_k = AddressOf( k )
> >

> #define SetPointer
> #define AddressOf( n ) &##n;


You forgot:

#define BEGIN {
#define END }

<g>


 
Reply With Quote
 
Old Wolf
Guest
Posts: n/a
 
      09-18-2005
Ian wrote:
>>
>> Compare this to Visual Basic. If you could do something like
>> "p_k = &k" in VB, then it'd probably look like:
>>
>> SetPointer p_k = AddressOf( k )
>>

> #define SetPointer
> #define AddressOf( n ) &##n;


Should be:
#define AddressOf(n) &(n)

We aren't making a new token here; the address-of operator and the
thing that we're taking the address of, are separate tokens.

Note that the OP is hoist by his own petard. He could easily
have written:
pointer_to_k = &k;

and then even a non-C++ programmer (who did know what a pointer was)
would be able to guess that & means address-of.

 
Reply With Quote
 
Old Wolf
Guest
Posts: n/a
 
      09-18-2005
ToM_tOm wrote:
>
> C++ is not at all "anti-rust". By that, I mean that it's very easy
> to become rusty at it, and once you do, you're perplexed looking at
> all the strange syntax!


The technical term would be that C++ is not "memorable".
But memorability means different things to different people...
>
> SetPointer p_k = AddressOf( k )
>
> which we English speaking humans can understand very easily!


And what about non-English-speaking humans? English is only
the first language of 9% of the world's population, and that
is declining.
Would you really have had any better luck with:

FijeLaDireccion p_k = IndicadorDe( k )

or perhaps even

设置尖 p_k = 地址( k )

which is about as sensible as your code would look to a Chinaman.

> I'm not all suggesting that the language should be dumbed-downed
> or deficienized


It would be helpful if you used actual English words

> (as is the case with VB), but I think it would be helpful if
> actual English words were used in the place of symbols.


Why then did you not suggest:

SetPointer p_k Equals AddressOf OpenBracket k CloseBracket

Or is it only certain symbols that are not very memorable?
I, for one, find "&" more memorable than "k" and "p_k".

My opinion: usability is more important than memorability, for
a programming language. Once I've learned C (or once you have
applied rust-killer to your brain), it is more productive to
work with short symbols than with long words.

> The whole "alien language" aspect is what makes C++ so daunting
> for beginners. To a person who doesn't know C++, or who is rusty,
> a C++ source code file looks like horribly complex gobledygook!


Be glad you've never tried to learn Perl.

> Little do they know though that we C++ programmers read through it
> as easy as our native language... just so long as we're not rusty!


Nobody ever gets rusty at their native language.

> Because we use symbols in C++, if we go a good deal of time without
> using it, we become horribly rusty.


I don't. Buy a C++ book and learn it a bit better!

> Maybe someone out there has made a parser to change symbols into
> words and vice versa?


#define is your friend. (But don't expect anybody else to
want to work on your code).

 
Reply With Quote
 
Dave Rahardja
Guest
Posts: n/a
 
      09-19-2005
On 18 Sep 2005 16:55:48 -0700, "Old Wolf" <(E-Mail Removed)> wrote:

>Why then did you not suggest:
>
> SetPointer p_k Equals AddressOf OpenBracket k CloseBracket


I've just had a COBOL flashback. Cold sweats!


>> The whole "alien language" aspect is what makes C++ so daunting
>> for beginners. To a person who doesn't know C++, or who is rusty,
>> a C++ source code file looks like horribly complex gobledygook!

>
>Be glad you've never tried to learn Perl.


;^D


>> Because we use symbols in C++, if we go a good deal of time without
>> using it, we become horribly rusty.

>
>I don't. Buy a C++ book and learn it a bit better!


To the OP: I think the secret is to think of the symbols as _part_ of the
language, just like words. If it helps, you can pronounce the symbols as
though they were words, just like you might do with mathematics symbols.

The use of symbols is important because they concisely express relatively
complicated ideas. The challenge is to find a balance between readability and
conciseness.

Compare Python to Perl, for example: Python is readable but tend to be more
verbose, while Perl is concise but can be a challenge to decipher; and both
languages are somewhat similar in capability.

-dr
 
Reply With Quote
 
Ian
Guest
Posts: n/a
 
      09-19-2005
Old Wolf wrote:
> Ian wrote:
>
>>>Compare this to Visual Basic. If you could do something like
>>>"p_k = &k" in VB, then it'd probably look like:
>>>
>>>SetPointer p_k = AddressOf( k )
>>>

>>
>>#define SetPointer
>>#define AddressOf( n ) &##n;

>
>
> Should be:
> #define AddressOf(n) &(n)
>

Oops, didn't spot that.....

Ian
 
Reply With Quote
 
Jim Langston
Guest
Posts: n/a
 
      09-19-2005
"Dave Rahardja" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On 18 Sep 2005 16:55:48 -0700, "Old Wolf" <(E-Mail Removed)> wrote:
>
>>> The whole "alien language" aspect is what makes C++ so daunting
>>> for beginners. To a person who doesn't know C++, or who is rusty,
>>> a C++ source code file looks like horribly complex gobledygook!

>>
>>Be glad you've never tried to learn Perl.

>
> ;^D


Forget perl, try looking at APL code sometime!

Here's a sample to figure out the primes:
http://www-users.cs.york.ac.uk/~susan/cyc/p/apl.gif


 
Reply With Quote
 
=?ISO-8859-15?Q?Juli=E1n?= Albo
Guest
Posts: n/a
 
      09-19-2005
ToM_tOm wrote:

> Compare this to Visual Basic. If you could do something like "p_k = &k" in
> VB, then it'd probably look like:
>
> SetPointer p_k = AddressOf( k )
>
> , which we English speaking humans can understand very easily!
>
> I'm not all suggesting that the language should be dumbed-downed or
> deficienized (as is the case with VB), but I think it would be helpful if
> actual English words were used in the place of symbols.


You can do it easily:

template <typename T>
inline T & AddresOf (T & t)
{
return & t;
}

--
Salu2
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorry for interrupt,because my mother language is not English,it maybe a little confused to read the c programming language. Zhang Yuan C Programming 6 06-14-2012 04:35 AM
Can Your Programming Language Do This? Joel on functional programming and briefly on anonymous functions! Casey Hawthorne Python 4 08-04-2006 05:23 AM
A language-agnostic language Ed Java 24 03-27-2006 08:19 PM
Using a Scripting Language as Your Scripting Language DaveInSidney Python 0 05-09-2005 03:13 AM
Python is the best and most popular general purpose scripting language; the universal scripting language Ron Stephens Python 23 04-12-2004 05:32 PM



Advertisments