× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Clever UNIX/C Constructs
  • From: Evan Harris <spanner@xxxxxxxxxx>
  • Date: Thu, 04 Jan 2001 23:20:12 +1300

Hi Scott

The original thread (which I think I started) was based on the premise that:

EVAL Variable = Variable + 5

is, in my opinion at least,

much more readable and obvious than

variable += 5

So far the major argument for providing this syntax has been to save 
typing: if there is another argument I'd be more than interested to hear it 
as I really cannot see what it adds to any language. As per Richard's 
comments it seems it arose from a design decision due to limitations of the 
past - just as the columnar RPG format was rooted in its origins.

I agree with your statements regarding RPG syntax not necessarily being 
obvious to the uninitiated, but it seems to me that += etc is just more of 
the same from a different language. To make it clear where I am coming 
from, would you want indicator logic added to C ? Why add something to RPG 
that adds nothing content-wise merely additional form ?

Excuse my ignorance if I get this wrong (I have no more than a passing 
acquaintance with C) but in the above example what would be the effect  of:

variable =+ 5

Would it (as I understand it) assign 5 to the variable rather than 
incrementing it by 5 ? What are the side-effects (bad choice of words 
possibly) of other incorrectly typed terse assignments ? And what is the 
effect on debugging to those that are not proficient with this style of 
expression ?

These days when I code I like to think that I am coding for "whoever comes 
next" and that they will (hopefully) be impressed with how easy it is to 
maintain or (god forbid) debug - not by having to refer to the manual to 
understand indicators, cycles, expressions or whatever.

Since I don't live in the US I'll keep any comments about voting to myself 
<G> I figure it's probably a hot topic

Regards
Evan Harris

>I'm sorry, but if you really and truly  believe that THIS is hard to
>follow:
>                     Variable += 5
>
>But you think that this isnt:
>
>      C                   ADD       5             Variable
>
>Then it HAS to be because of what you're used to, and not whats actually
>easy to follow.
>
>If a new programmer can say "'+=', what does that do?"  He can surely also
>say  "Theres a C in position 6, what does that do?"  "Why do I have to put
>the O specs after the C specs?  Why do I have to put the P specs after the
>O specs?  What is 04?  Why does turning on 04 cause the program to print
>[something] on the screen?"
>
> >
> > The obvious reason I can think of this is because it's just not a good 
> idea!
> > It makes code hard to maintain and debug.  In practicality all we are 
> doing is
> > saving a few characters typing.
>
>Whether it is a good idea or not is purely your opinion.  It is certainly
>used in far more languages than MANY, if not ALL of the common features of
>RPG.  The fact that you can put a "C" in column 6, and the format of the
>line STILL is different depending on if the op-code is "IF" or "IFEQ" is a
>good example of why RPG is harder to learn than C.
>
>Hard to maintain and debug?  Because you typed "A += 5" instead of
>"C   ADD  5  A"?  That makes it hard to maintain and debug?!  Yeah, thats
>why companies need to hire "variable assignment specialists" to debug C
>code (sarc)
>
>
> > There is the fact that functions will only
> > be called once instead of twice, but this is rather the exception to 
> the rule
> > rather than the rule itself.
> >
>
>Huh?  Are you suggesting something like   function(A:B) += 5???    Where
>are you assigning the result of this expression to?
>
>
>If you don't like the += type operators, don't vote for them.  If you do,
>vote for them.  Let the majority decide.  Isn't that what VOTES are FOR?
>
>Don't you feel the slightest bit guilty saying "I dont like the short form
>operators, so people shouldnt be allowed to vote for them!"???

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.