RE: [JSMentors] What's the best way to implement Object Inheritance?

2010-12-17 Thread And Clover
On Fri, 2010-12-17 at 16:19 +, 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 J

RE: [JSMentors] What's the best way to implement Object Inheritance?

2010-12-17 Thread Joel Dart
>Since you have returned a new object rather than using `this`, an instance of >your `Circle` won't respond to `instanceof Circle`. Concerning instanceof on custom objects, what scenarios do you find it necessary vs duck typing(http://en.wikipedia.org/wiki/Duck_typing)? I can see the advantage

Re: [JSMentors] What's the best way to implement Object Inheritance?

2010-12-17 Thread And Clover
On Fri, 2010-12-17 at 06:53 -0800, qwertypants wrote: > I'd like to find the best way to do so. There's no one accepted best way. There are two broad approaches: prototypes and closures; they both have positive and negative points. There are naturally a *lot* of variations within each type, and al

Re: [JSMentors] What's the best way to implement Object Inheritance?

2010-12-17 Thread Asen Bozhilov
qwertypants: > I'm a bit new to Object Inheritance in JavaScript and I'd like to find > the best way to do so. I have seen a few techniques from Resig to > Crockford, but I'd like to know the simplest and most effective way to > create object from existing ones. Is there any native way that this >