joyent/node — Issue #2628: Feature: in-source command line options
Author: arturadib
Created: 2012-01-28 13:45:47+00:00
State: open

It'd be superbly useful if we could specify command line options and other system macros (e.g. version detection) inside our JS files. This would be particularly helpful since V8 allows for a range of nifty options that can completely modify the runtime behavior of the script.

For example, something like this is what I have in mind:

```javascript
// !node-ver: > 0.6.7
// !node-opts: --harmony_block_scoping --harmony_proxies

var fs = require('fs'),
...
```

Details of the implementation to be determined :), but one way to implement this is to spawn a new node process with said options and kill the current one (that is, if the source file contains the right keywords in the initial comments).

/cc @bnoordhuis @ry