× 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: Overloading in RPG.
  • From: "Bartell, Aaron L. (TC)" <ALBartell@xxxxxxxxxxxxxx>
  • Date: Wed, 9 May 2001 07:14:08 -0500

>What if you had a procedure with two functions, however in both cases you
>passed the same three parameters?  Just different functions. How would
>overloading do that?

This would produce a compile time error.

>How would Java's overloading handle wanting to do multiple functions with
>the Same Parms passed ? The kind of thing we used to do in utility programs
>even in CL 15 years ago?

The main idea behind overloading is that you can have same named sub
procedures with _different_ amounts of parms or _different_ parm types
passed to them.

Let me see if I can think of a good example. . .<thinking>

Lets say that you need to calculate the due date for an order that you just
received, and your company calculates the due date based either upon
customer number or item ordered.  So you would setup a procedure to hold two
sub procedures both named #calcDueDate.  Based on order 123 you may want to
calculate the due date based on customer for whatever reason.  So you would
call the first sub procedure named #calcDueDate that accepts a 9-digit
numeric value.  And then order 456 you may need to calculate the due date
based on item number.  You would call the same named sub procedure,
#calcDueDate, but since the item is 10-alpha it would know to call the
second of the two same named #calcDueDate sub procedures because the second
accepts a 10-alpha parm.  Yes you could create sub procedures named
#calcDueDateCust and #calcDueDateItm and I see your point that it could get
out of hand creating multiple sub procedures of the same name.  But can you
see the benefit to doing overloading if it is done right?

Aaron Bartell
 


-----Original Message-----
From: jpcarr@TREDEGAR.COM [mailto:jpcarr@TREDEGAR.COM]
Sent: Tuesday, May 08, 2001 8:01 PM
To: RPG400-L@midrange.com
Subject: RE: Overloading in RPG.



>Some people would argue that overloading is syntactic sugar.  I'm neutral.
>Generally overloading is used to do something that is different in detail,
>not totally different. Joel Fritz



I would tend to agree.  Just because C++ or Java has it doesn't necessarily
mean it's the best idea I don't think.

 Even in RPGIII we would have passed four parms, the
three that did the work and the forth(usually first) is a function number.
This number(ie could be 1,2,3, etc) would tell the "proc" what function you
wanted to do with the three identical parameters.



John Carr

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