Michael Dinowitz wrote: > My example left out the default. If a CFPARAM exists with a name > but no default, it throws an error if the variable does not > exist. i.e. it's saying that the variable has to exist. > If I read your idea right, any error will result in the default > being used so if myID is a string, rather than an error we'll get > a value of 0 for the variable. My idea makes the handling of the > error something that can be coded where your approach forces a > default value on error. It also doesn't address when the tag is > used without a default.
There are a few problems, as I see it, with this suggestion: 1) What happens if the proposed default does not conform to the specified type? I.e., you specify a type of "Numeric" and specify a default of "hello". While this may not be likely when hard-coding a default value, there are plenty of time where the default is determined by some other variable's value. 2) Adding a closing CFPARAM tag to include error-processing code does not seem to include an elegant way of differentiating between different reasons for the error. Was the error caused because of an invalid type, because it was undefined and no default was specified, etc.? You could probably handle this with multiple CFIFs, but it's kind of kludgey. Especially since CF already has a full TRY/CATCH/THROW implementation. I'd rather see the CFPARAM tag throw different kinds of exceptions depending on the cause of the error and allow you to catch the exception with the existing exception handling capabilities. 3) What if I don't want or expect the default value to be used in case of a type-mismatch? This could break existing code. -- Mosh Teitelbaum evoch, LLC Tel: (301) 942-5378 Fax: (301) 933-3651 Email: [EMAIL PROTECTED] WWW: http://www.evoch.com/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232278 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

