Yeah, this is a fanstastic edition and removes the "Rubyness" of Duck
Typing.

:-)

I don't think there is anything wrong with explicitly setting the type when
it's required such as Web Services return values etc.

I remember Seans preso but in all reality most the frameworks/tools I have
delved into don't "Duck Type" and explicitly set types so it can't be that
bad.









"This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant,
Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions." 
Visit our website at http://www.reedexpo.com

-----Original Message-----
From: Judith Dinowitz
To: CF-Talk
Sent: Thu Jun 07 04:02:48 2007
Subject: Re: CFC Typeof()

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




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

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

Reply via email to