[Gambas-user] Try;If Error on mutable classes

B Bruen bbruen at ...2308...
Mon May 12 13:07:28 CEST 2014


OK,this has me beat.

Given a mutable object, as in it might be an instance or Form1 or Form2 depending on some value, then having created that instance and where the instance is lacking a method, say LoadData(), when we attempt to invoke a method that "should" be prescribed for the mutable object that method may or may not have been coded in the class.

So, we try(sic) as follows:
1:	Try MyObject.MissingMethod(whatever)
2:	If Error then
3:		Error Subst("&1\nERR: &2 (&3)\n&4\n&1\n", String$(40, "-"), Error.Text, Error.Code, Error.Backtrace.Join("\n"))
4:  	Endif   

Line  3 fails with a null (Error) object.

There seems to be two problems here.
1) Why is the Error instance a null, and
2) (Harder) If, when trying to invoke an unknown method in a classifier then should not the interpreter raise the normal error " Unknown Symbol  blah blah" 

or have I forgotten something here?

-- 
B Bruen <bbruen at ...2308...>




More information about the User mailing list