× 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: [Re: RPGILE V4.3 Gotcha]
  • From: boldt@xxxxxxxxxx
  • Date: Thu, 7 Oct 1999 09:13:10 -0400



I know I should just let this thread drop, but there are still some
interesting aspects to this discussion.

Jim wrote:
>I know how to program in a lot of languages.  These include Basic (all types),
>Pascal, C, dBase and Clipper, assembly (80x86), LOGO and a little COBOL,
>FORTRAN and PERL:  There are others but I forget them all.
>
>None of those languages treats math the way RPG does in the EVAL statement.
>
>Yes, it is understood that the majority of decimal math is done in floating
point
>variables, but not all.  Take, for an example, Basic's Currency, which is a
fixed
>2 decimal format.
>
>RPG, in this case, is the odd man out.

I noticed you haven't mentioned PL/I.  Interesting.  PL/I has
different rules yet again!  It has it's own set of quirks regarding
decimal arithmetic, yet many people still use it.

You do offer an interesting suggestion, though:  Perhaps we should
have a "CURRENCY" attribute on decimal numeric variables, which
would ensure that decimal precision never drops below the declared
number of decimal digits within expressions.  (Basic's 2 decimal
place currency format seems a bit restrictive.  Not all countries
use 2 decimal places in their currency.)


>
>Now to answer your points.
>
>1.  Computer programming is hard.
>It is?  This is news to me.  I've been programming since I was 10 years old,
and
>am 35 years old now.  I have picked up and dropped so many languages over the
>years I can't remember them all (remember Symphony?).  To me, programming
>is not hard, it is logical.  Or is supposed to be logical.  I do not program
for a
>living because I make a ton of money doing it and work short hours, neither of
>which is true.  I program because I enjoy it.  If I didn't like programming,
I'd
>be doing something else.

I'm like you - I wouldn't do computer programming if I didn't
enjoy it and wasn't good at it.

Sure, the title of that point was meant to be provocative. But I
stand by it.  In my humble opinion, too many programmers are too
complacent about their craft.  It is all too easy these days to
pick up something new, have some early successes, and think you
know all about it.

You mentioned Perl in your own list of languages.  Do you read
comp.lang.perl.misc?  I see many people post questions and
very often the answer is "Did you use -w and use strict?"  A
beginner can quickly learn enough to write a Perl program, but
it takes more understanding to appreciate the importance of
things like "-w" and "use strict".  It's that kind of
necessary wisdom that's hard.


>
>2.  Learning programming is hard
>I've learned programming a long time ago.

Me, I started learning programming in 1976.  And I'm still learning
programming.  I didn't stop learning when I quit school in 1980.


>With the exception of style changes
>and unique characteristics, picking up a new language for me is rather simple.
>Notable exceptions being C (the 4th one I learned) because of it's pointer
>issues and assembly (same situation).

Then I take it you haven't yet learned object-oriented programming.

Learning programming is much more than just learning the peculiarities
of particular programming languages.  Take OOP for instance.  In my
opinion, no-one schooled in procedural programming can really understand
object-oriented programming without first feeling like a complete
idiot.  If you think you know OOP without going through that phase, you
really don't know OOP.

The realization that one must pass through through that "complete
idiot" phase is hard for many people to accept.  We don't like
feeling like idiots.  Yet, IMHO, it's often necessary to shake off
old prejudices and beliefs in order to learn and accept new things.

(On the other hand, IMHO, over time, the teaching of OOP will improve to
make the process less painful.  But then again, the need to teach new
tricks to us old dogs will decrease as we retire and more and more new
programmers learn OOP right from the start.)

But here's what I don't understand with this discussion:  Learning a
new set of arithmetic rules in a programming language really doesn't
compare with learning a whole new way of approaching programming or
a whole new operating system.  Many RPG programmers have made the
transition to RPG IV with little effort and few complaints.


>
>3) "There's than one way to do it!"
>Interestingly enough, you have an "IF" opcode, that surprisingly does the same
>thing it does in Basic, C, pascal, etc...  And your "DO" while, until does the
>same thing it does in the other languages.  END IF, GOTO, MULT, etc...  If I
see an
>"IF" statement in any language, I know what it's going to do.  Same with the
>others. And in Basic or Pascal or Clipper or C if I see something like:
>A = B * C * E / F / G
>A := B * C * E / F / G
>
>There are only two things I am going to be looking at to figure the value of A.
>First is the order of operations (is it * or / probably same, and is right to
>left, or left to right) and the second is the size of my variables.  And I
would
>be right.  Except in RPG where the answer could be totally different than any
>other language.
>
>Why?  Because RPG wants to do it different than every other language, for no
>really good reason that I can see.  If the fact of the matter is there is a
problem
>and that RPG is not capable of doing it that way, I would understand.  But,
there
>is an H spec switch we can set to make it like the rest of the world.

Here's where I really take offense at your assertions.  You claim that
we want RPG to be different for no good reason?  You have no idea what
went into the design for decimal arithmetic.  The fact is, we looked
at many different sets of rules, and for each, we found cases where the
rules would cause possibly unexpected results.  Unless we did the
arithmetic with infinite precision and infinite speed, there was no way
we could satisfy everyone.  That's the reality of programming language
design.

If you think you can design a programming language better, then please
feel free to do so.


>
>What I really think happened is when the EVAL statement was originally coded
>the programmers wrote it backwards, then tried to "fix it" with the header
spec.
>
>If that's the case why not just admit it, and move on?  Instead of telling
peoople
>they're supposed to know that RPG is backwards if they had RTFM.

Look, I've stated before that, sure, we could have made some better
design choices.  But we have a policy of trying to ensure that a
working program compiled several years ago will work the same today
when compiled on a newer release.  We can't go back and arbitrarily
change the rules, and our customers expect that.

Cheers!  Hans

Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com


+---
| 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:

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.