From: Mark M. <mie...@gm...> - 2007-07-14 14:57:24
|
On 7/14/07, Rony G. Flatscher <Ron...@wu...> wrote: > > Rick McGuire wrote: > >> And would also be difficult to implement, harder to extend in the future, >> and impose more responsibility over anybody wishing to subclass the methods. >> These are also more difficult to document, since all of the options get >> presented in one place, frequently with complex syntax diagrams, which make >> it more difficult to locate the correct function. And when it's all said >> and done, you STILL have multiple methods, but now the names include a >> couple parens and quotation marks in order to use. > I do not agree (for ooRexx). > > It is fairly easy to explain newcomers as well as experts the BIF > "DATATYPE", its purpose, its parameters. The documentation is clear and easy > to understand, although there are *thirteen* different modes/implementatoins > of carrying out that single BIF! > > Following the belief "one functionality, one function" at all times, one > would have to implement all variants of the DATATYPE usage/mode as their own > function/method, hence one would come up with the following function/method > galore: > > DATATYPE(val), returns "NUM" or "CHAR" > isDataTypeAlphaNumeric(val): returns .true or .false > isDataTypeBinary(val): returns .true or .false > isDataTypeLowerCase(val): returns .true or .false > isDataTypeMixedCase(val): returns .true or .false > isDataTypeNumber(val): returns .true or .false > isDataTypeLogical(val): returns .true or .false > isDataTypeSymbol(val): returns .true or .false > isDataTypeUpperCase(val): returns .true or .false > isDataTypeVariable(val): returns .true or .false > isDataTypeWholeNumber(val): returns .true or .false > isDataTypeHexaDecimal(val): returns .true or .false > isDataType9(val): returns .true or .false Some observations: > > We now have 13 (!) functions instead of one! This would make it *hard* on > the user (ooRexx programmer). There is more in the whole e-mail than I can reply to, so I'm just picking this portion. For myself, I see it this way. Almost every time I use DataType, I look it up because I can not remember what the flag is that I need to check for the particular type I am checking for. However DataType here is a function, I'm used to having to look up the correct parameters for functions. So I never thought about it much until you brought up the easy to remember part. Second, I think there is a difference here between a function and a method of a class. Plus, I think you over-did the names to help make your point, which is perfectly legit, I do it all the time. <grin> I think you should pick the datatype *method* for this example and you don't need to put datatype in the name: item = ioObject~readWord if item~isAlphaNumeric if item~isBinary if item~isLowerCase if item~isMixedCase if item~isNumber if item~isLogical if item~isSymbol if item~isUpperCase if item~isVariable if item~isWholeNumber if item~isHexaDecimal I would prefer that over: if item~datatype( 'O' ) And it would be easier for me to remember. And, I think it reads more like the English than a computer language. Which is the only part of "rexx-ish" I understand. <grin> Now, one thing I think is true about life in general is, all things in moderation. I agree this can be overdone. However, for this one part of your argument - your argument swayed me in the opposite direction you intended. <grin> -- Mark Miesfeld |