| FWIW I tried looking a few up and standard library seemed hit-or-miss: JavaScript it didn't work: class testClass {
constructor() { }
callHoHe() {
console.log('ho', 'he');
}
}
let hi = new testClass();
hi.callHoHe();
testClass.callHoHe = () => {
console.log('haha');
}
let heh = new testClass();
heh.callHoHe();
This ended up just printing 'ho', 'he' twice,For Java people didn't think it was possible: https://stackoverflow.com/questions/47006118/is-there-any-wa... For Java they said here that you just have to use your own similar implementation. And for C# they have some pretty intense restrictions on overriding standard library stuff: https://stackoverflow.com/questions/21302768/where-we-can-ov... Golang doesn't seem to have this functionality as well: https://stackoverflow.com/questions/37079225/golang-monkey-p... Ps. it would have been nice to have monkey patching when dealing with btoa and atob in JavaScript, since they have different function on NodeJS vs the browser. |