Are there any smart cases of runtime code modification?

There are many valid cases for code modification. Generating code at run time can be useful for: Some virtual machines use JIT compilation to improve performance. Generating specialized functions on the fly has long been common in computer graphics. See e.g. Rob Pike and Bart Locanthi and John Reiser Hardware Software Tradeoffs for Bitmap Graphics … Read more

Node.js – Find home directory in platform agnostic way

As mentioned in a more recent answer, the preferred way is now simply: const homedir = require(‘os’).homedir(); [Original Answer] Why not use the USERPROFILE environment variable on win32? function getUserHome() { return process.env[(process.platform == ‘win32’) ? ‘USERPROFILE’ : ‘HOME’]; }