|
>I don't see how that solves the problem? Unless you wanted to write the same code twice, that is. The example you gave at the bottom of the program is what I am talking about. Instead of getCust(nbr: *Omit) and getCust(*Omit: 'John') you would create getCustByName and getCustByNbr. <Scott> I won't. I don't like overloading. I think it's confusing when the compiler gives you an error "procedure not found" and the reason turns out to be that one of your variables is a "short" and the procedure was expecting an "int". That's not intuitive. </Scott> I think implicit type casting would solve the above problem, but I am guessing you would still have a beef if we could create our own objects in RPG and the difference between two same-named sub procs would be that they accepted different types of objects. I think this would be very nice when used appropriately. <Scott> I don't like it when I search a program for a procedure called "GetCust" fix a bug in it, and it has no effect because there's more than one procedure called GetCust. </Scott> Well written overloaded sub procs will not have much if any duplicate code, IMO. You put the reusable pieces of code in non-exported sub procs that can be used by all of the GetCust overloaded methods. >I don't like having to specify a "mangled" name when creating binder source, or when using %paddr(). Not sure what you mean here. >The problems of overloading far outweight the minor difficulties of making procedure names like "GetCustByName" instead of "GetCustByNumber" I think they should be added, and if you don't like them then you can go and camp out with Joe in the "un-useful RPG enhancements" camp :-) Aaron Bartell
As an Amazon Associate we earn from qualifying purchases.
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.