Anti-rust programming language

Discussion in 'C++' started by ToM_tOm, Sep 18, 2005.

  1. ToM_tOm

    ToM_tOm Guest

    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
     
    ToM_tOm, Sep 18, 2005
    #1
    1. Advertising

  2. ToM_tOm

    Ian Guest

    >
    > 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
     
    Ian, Sep 18, 2005
    #2
    1. Advertising

  3. "Ian" <> wrote in message
    news:...
    > >
    > > 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>
     
    Walter Bright, Sep 18, 2005
    #3
  4. ToM_tOm

    Old Wolf Guest

    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.
     
    Old Wolf, Sep 19, 2005
    #4
  5. ToM_tOm

    Old Wolf Guest

    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).
     
    Old Wolf, Sep 19, 2005
    #5
  6. On 18 Sep 2005 16:55:48 -0700, "Old Wolf" <> 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
     
    Dave Rahardja, Sep 19, 2005
    #6
  7. ToM_tOm

    Ian Guest

    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
     
    Ian, Sep 19, 2005
    #7
  8. ToM_tOm

    Jim Langston Guest

    "Dave Rahardja" <> wrote in message
    news:...
    > On 18 Sep 2005 16:55:48 -0700, "Old Wolf" <> 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
     
    Jim Langston, Sep 19, 2005
    #8
  9. 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
     
    =?ISO-8859-15?Q?Juli=E1n?= Albo, Sep 19, 2005
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. anon
    Replies:
    2
    Views:
    424
    MadCrazyNewbie
    Apr 6, 2004
  2. ~~~ .NET Ed ~~~
    Replies:
    1
    Views:
    322
    Scott Allen
    Mar 21, 2005
  3. Mark Rae
    Replies:
    0
    Views:
    625
    Mark Rae
    Mar 7, 2006
  4. Tim Tyler

    LCD anti-aliasing in Java

    Tim Tyler, Sep 4, 2003, in forum: Java
    Replies:
    2
    Views:
    1,287
    Tim Tyler
    Sep 5, 2003
  5. Casey Hawthorne
    Replies:
    4
    Views:
    1,010
    Jarek Zgoda
    Aug 4, 2006
Loading...

Share This Page