|
> it is also a violation of the principle of modularity. A proc/module > should not know that 4 levels up is the driver CL at which all > exceptions are caught. A module throws an exception back to its > caller. It is the callers responsibility to promote that exception or > to handle it. Throwing an exception up 4 levels is a CHOICE not a requirement. You're completely welcome to always go back one level if you want to. Indeed, the DEFAULT behavior of RPG when it receives an exception is to signal an exception to the previous call stack level, thus bubbling up one level at a time until a MONITOR or PSSR (or similar construct in another language) is found. There are other languages, like Java, that have some really slick exception models, such as the ability to force the caller to be ready to handle any error that a given method can throw... But, RPG does have the basics. Indeed, they're part of OS/400 and have been there since the dawn of time. > I dont think that is true and besides, that example limits the work of > a destructor to memory management. Regarding destructors, it's possible to register a subprocedure that gets called whenever a particular ILE call stack entry ends abnormally. It's also possible to register a subproc to be called when the activation group ends. Or, you can simply scope everything to the activation group and have the system automagically clean it up when your program ends. While you may not have a formal destructor, you've certainly got options for cleaning things up...
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.