For more on duck typing, you might want to check out Fusion Authority 
Quarterly Update Volume 1 Issue 1 (PDF for free):

http://www.fusionauthority.com/quarterly/FAQU-Vol1-Issue1.pdf
Judith Dinowitz
Editor-in-Chief: Fusion Authority
http://www.fusionauthority.com

----- Original Message ----- 
> You don't want to do that in Coldfusion - it is unnecessary and is 
> actually a performance hit as well. Read up on 'duck typing' - Sean 
> Corfield has a nice powerpoint that outlines this concept. You have to 
> remember that Coldfusion does not enforce strict typing; Coldfusion is not 
> Java!! The basic idea is that if you pass in a value (be it a string, 
> query, object, whatever) and it works within your code, it is of the 
> correct type (if it walks like a duck, quacks like a duck, it's a duck!). 
> If you pass in a numeric value to a function that is expecting a string, 
> it's going to work. If you pass in an object with properties x, y, and z 
> to a function expecting an object with properties x, y, and z it's going 
> to work. If you were to restrict your function to only accept objects with 
> a type of cfc.exampleObj, you are unnecessarily restricting the possible 
> input of your function as well as creating a performance loss by making 
> your function check the object's type in the first place!
>
> As defined by Wikipedia - http://en.wikipedia.org/wiki/Duck_typing
>
> Jake Pilgrim


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280319
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to