Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Monkey patching is not ruby-explicit, its done all over javascript too, with negative (IMO) effects.</p> <p>My personal opinion is monkey patching should only be done to </p> <p>a) Add functionality to an old version of a language which is available in the new version of the language which you need. </p> <p>b) When there is no other "logical" place for it. </p> <p>There are many many easy ways to make monkey patching really awful, such as the ability to change how basic functions such as <em>ADDITION</em> work. </p> <p>My stance is, if you can avoid it, do so. </p> <p>If you can avoid it in a nice way, kudos to you. </p> <p>If you can't avoid it, get the opinion of 200 people because you probably just have not thought about it hard enough. </p> <p><strong>My pet hate</strong> is mootools extending the <strong>function</strong> object. Yes, you can do this. Instead of people just learning how javascript works: </p> <pre><code>setTimeout(function(){ foo(args); }, 5000 ); </code></pre> <p>There was added a new method to every function object, ( yes, im not joking ) so that functions now have their own functions. </p> <pre><code>foo.delay( 5000 , args ); </code></pre> <p>Which had the additional effect of this sort of crap being valid: </p> <pre><code>foo.delay.delay( 500, [ 500, args ] ); </code></pre> <p>And on like that ad infinitum. </p> <p>The result? You no longer have a library, and a language, your langauge bows to the library and if the library happens to be in scope, you no longer have a language, and you cant just do things the way that they were done when you learn the language, and instead have to learn a <strong>new</strong> subset of commands just to not have it fall flat on its face ( at the cost of excessive slowdowns! )</p> <p><sub> may i note that foo.delay also returned an object, with its own methods, so you could do </p> <pre><code>x = foo.delay( 500, args ); x.clear(); </code></pre> <p>and even </p> <pre><code> x.clear.delay(10); </code></pre> <p>which may sound overly useful, ... but you have to take into consideration the massive overhead used to make this viable. </p> <pre><code> clearTimeout(x); </code></pre> <p>SO HARD!</p> <p><b>(Disclaimer: its been a while since I used moo, and have tried to forget it, and function names/structure may be incorrect. This is not an API reference. Please check their site for details ( sorry, their API reference sucks! )) </b> </sub></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload