On 22/11/06 22:31, "Charles Yeomans" <[EMAIL PROTECTED]> wrote:
> > The simplest, and my opinion correct, solution would be for a failed > assertion to raise an exception. Assertions aren't for error- > handling; they are for error-generating. Absolutely agree on both counts. In my view of things they are for situations that are NEVER meant to happen, not "special cases" that need to be "dealt with" somehow. As others have said, meta string variables for methodname, classname and line number would help us in "rolling our own" Assert(), but only a built in RB Assert syntax would allow us to include the test string. Maybe a special "meta-function" call which returns a string containing the source line used to call the current method one is in would do the trick - so letting us write our own custom Assert function like this: Function Assert( condition as boolean ) Dim e as new myCustomAssertException E.message = "Assert Error: Class: "+ META_CURRENT_CLASSNAME + " Method: " + META_MYCALLERNAME + " Line " + META_MYCALLER_LINENO + " Source: "+ META_MYCALLER_SOURCELINE Raise e End Function Here META_MYCALLERNAME is the name of the method which called function Assert() META_MYCALLER_LINENO is the number of the line that called function Assert() META_MYCALLER_SOURCELINE is the source for the line that called function Assert() All of this meta information can be determined at compile time. Personally , useful though these meta thingies would be, I would still prefer an actual Assert syntax to wrap all this up, albeit in a customisable manner. _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
