Thanks David. How, in the case of boggis, which can handle either a string or an array, can it determine which it's been handed. datatype() doesn't seem to help with this.
im ------ Original Message ------ Received: 09:05 AM COT, 05/07/2009 From: David Ashley <david.ashley....@gmail.com> To: Open Object Rexx Users <oorexx-users@lists.sourceforge.net> Subject: Re: [Oorexx-users] Polymorphic(?) methods > Ian S. Worthington wrote: > > Hi -- > > > > In many other OO languages I can write (polymorphic, iirc?) methods which have > > the same name but different types (and numbers) of arguments eg > > > > boggis( string ) > > boggis( array ) > > > > I can't find how to do this in oorexx, or indeed if its possible. > > > > Failing that, given that boggis( thing ) is happy to accept both a string > > object or an array, is there a way for boggis to determine what its been > > handed so it can take the appropriate action? > > > > > > ian > > > This is actually easy. The main thing to understand is that a method can > receive any number or types of arguments. The method must decide what to > do wit the arguments. For instance: > > ::method mymethod > if arg() = 3 then do > use arg t1, t2 ,t3 > end > else do > use strict arg t1, t2 > end > if t1~datatype('W') then ... > else ... > > and so forth. There is no need, and in fact no way, to define multiple > methods with the same name with different signatures (signatures do not > exist in ooRexx). The method itself is the sole arbitrator of how > arguments are interpreted. > > David Ashley > ooRexx Team > > ------------------------------------------------------------------------------ > The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your > production scanning environment may not be a perfect world - but thanks to > Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 > Series Scanner you'll get full speed at 300 dpi even with all image > processing features enabled. http://p.sf.net/sfu/kodak-com > _______________________________________________ > Oorexx-users mailing list > Oorexx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/oorexx-users > ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ Oorexx-users mailing list Oorexx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-users