On Sep 9, 6:05 pm, sean <[EMAIL PROTECTED]> wrote: > I'm working on a custom extension of a couple of functions to the > Object class and was just wondering how prototype connects functions > such as Object.inspect(variable); to variable.inspect();
It doesn't : ) > > So far I have: > > Object.extend(Object.prototype, { It's a pretty bad idea to extend Object.prototype with custom properties. The only reason for doing this would be to replace native methods that are known to have a faulty behavior. You can find many lengthy explanations around the web why this is generally a bad idea. > talk: function(object) > { > if(typeof(this) != 'function') > object = this; > > alert(object); > } > > }); > > This seems like it should work for simple cases but will quickly > become more complicated if I want more that just the one parameter. > Given the amount that things like this are done in prototype I was > just wondering if there is a better way to accomplish this. Prototype extends `Object` (not `Object.prototype`). Which complications are you talking about? > - Sean -- kangax --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---