From: <rvj...@xs...> - 2007-04-15 12:02:24
|
Hi Lee, I respectfully disagree. I'll show you why. This shows rather poignantly what happens if variables aren't typed. =20 To go through it back-to front: your "read-only" variables should be =20 of an immutable (constant) type. Your (.true/.false) ones should be of some sort of Boolean type. The =20 varset you mentioned must make sure that it contains the things =20 needed, for example by providing sensible defaults in its constructor =20= method (the ~initialize) that is called when you 'instigate' it with =20 ~new. In OO, that is. The assertions are moved out to the responsible =20 parties; when a method checks the types of its arguments it knows =20 it's OK. As far as possible. My repeating contribution of type Tuppence. Ren=E9. On 15-apr-2007, at 13:40, Lee Peedin wrote: > I must say that with all the Symposium planning going on, I got =20 > lost early on in the details of this > thread; however, for what its worth, let me offer the following. > > I think I would have to agree with Rony that as a programmer I =20 > would tend to create my own > validation code for arguments. An example that starts out quite =20 > simple gets a bit involved the > deeper you go. > > In Rexx/SQL, Mark has defined a list of SQL variables. So to =20 > provide this data to the calling > program, my wrapper class has code as follows: > > varset is a "set" of the pre-defined SQL variables along with "ALL" > > ::method variable > use arg var_name,var_value > > This method requires arg(1) which must be in the varset - easy =20 > enough to check for: > if \varset~hasindex(var_name) then > raise syntax 40.26 array('The Variable', 1, arg(1)) > > arg(2), if specified, is used to "set" the value of arg(1); so if =20 > arg(1)~translate is "ALL" then > that's a problem, but again easy enough to check for: > if arg(2,'e') & var_name =3D 'ALL' then raise syntax 93.902 array(1) > > One might think that from this point on, coding would be easy: > if only arg(1) report the value of arg(1) back to the calling program. > if arg(2) then set the value of arg(1) to arg(2). > > HOWEVER nothing is as simple at it first appears: > Some of these variables require a logical value (.true/.false) > Some may require non-logical numeric values > AND there are some that are "read-only" whose value can not be =20 > changed. > > So I don't see how any form of "use" could "assert" all possible =20 > conditions. > > Just my 2 cents. > > Lee > > > > ----------------------------------------------------------------------=20= > --- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Oorexx-devel mailing list > Oor...@li... > https://lists.sourceforge.net/lists/listinfo/oorexx-devel > |