Replacing a native Object (Array) method with a custom method: Is it safe? Compatible?
<p>I've got an array, and it's got a method I threw onto it called <code>add</code>, which I use as a wrapper around <code>push</code>. I've found myself using <code>push</code> a few times when I should have used <code>add</code>, and now I'm thinking it would be nice to assign a reference to my <code>add</code> method to the array's native <code>push</code>. Thus, calling <code>push</code> on the array would call <code>add</code>.</p>

<p>Do internals depend on externally available native methods like <code>push</code>? How would this affect compatibility? Is this a bad idea? If so, why?</p>

<p><em>Some code</em>:</p>

<pre><code>PR.state = {
   views: []
};

_.extend(PR.state.views, {

   add: function(view) {
     var parent = view.parent;
     if ((!this.length &amp;&amp; view instanceof PR.Views.App) || (parent &amp;&amp; _.contains(this, parent)))
       this.push(view);
   }

});

// I am thinking:
PR.state.views.push = PR.state.views.add;
</code></pre>
