|
Hi David,
It's my recommendation that you keep your procedures encapsulated and stateless -- that will lead to easier maintenance down the road. With that in mind, I suggest the following:
a) Add a new parameter with options(*nopass) as suggested by Michael Schutte.
- or, since you don't like that -
b) Rename the existing procedure to a different name. Let's say it's currently called GetWidget(). Rename it to getWidgetEx(), and add the new parameter to it.
c) Create a new procedure named GetWidget() -- the same name as the original procedure, and give it the same parameters as the original procedure.
d) Have GetWidget() call GetWidgetEx(). Have it add the extra parameter with a default value before calling.
Assuming that you're using binder source properly, GetWidget() (the new one) will now be called by any existing callers. No need to change them. GetWidgetEx() will have the extra parameters, and can be called by new routines that need the extra parameters.
No need for global parameters, or separate routines to return them.
David FOXWELL wrote:
A new parameter is needed by one of the callers of an exported sub procedure.
Is there any harm in doing this :
Initialize the value of the new parameter in the exported sub procedure.
Add a new exported subprocedure GetNewParameter that returns NewParameter.
The caller that needs the parameter continues to call the original subprocedure as before and then calls GetNewParameter.
Other callers remain unchanged.
Does this make sense or is this just being lazy and are there any risks of it going wrong?
Thanks
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.