On Fri, 2010-12-17 at 16:19 +0000, Joel Dart wrote:
> Concerning instanceof on custom objects, what scenarios do you find it 
> necessary vs duck typing

It would primarily be used for allowing arguments of different types to
do different things: essentially simulating function overloading, since
JavaScript doesn't support that. Instead you check the types of the
arguments manually.

(Actually I find this easier to do anyway, in languages like JS and
Python. When you have multiple potentially-differently-typed or optional
arguments, you get a combinatorial explosion of tiny stub
functions/methods in C++/Java/etc which is less manageable than a few
instanceof checks.)

-- 
And Clover
mailto:[email protected] http://www.doxdesk.com
skype:uknrbobince gtalk:[email protected]


-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to