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






On Feb 23, 2010, at 12:51 PM, rpg400-l-request@xxxxxxxxxxxx wrote:

As far as seeing what the code path should be, how it this worse than using
MONITOR to avoid e.g. array index errors:

// Check for errors before processing
if a = 0 or
array.ptr(a) = null or
array.len(a) < 0;
throwError;
endif;

// Load newvar
varptr = array.ptr(a);
newvar = %subst( var : 1 : array.len(a) );

I know - it's a nice simple example. Can you show me an example of code that
uses MONITOR that couldn't equally clearly be written using specific error
checks?

Maybe it's the comments that make it clear? <grin>


You've provided your own answer Rory. Without the comments the code would tell me nothing.

To me this is really important in a maintenance context where I need to scan and understand as much code as quickly as possible. If I'm trying to understand the intended flow of the code, which is more obvious - your version or mine:

// Load newvar
Monitor;

varptr = array.ptr(a);
newvar = %subst( var : 1 : array.len(a) );
On-error;
throwError;

To me all the pointer testing etc. simply detracts from the point of the exercise which is to set a new value. I can also see exactly how the programmer intends to handle an error. No comments needed.

Jon Paris

www.Partner400.com
www.SystemiDeveloper.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.