Perhaps design docs could be allowed to provide init functions which would be passed to the view server whenever the view server is (re)started or the design doc is updated?
The view server would maintain a distinct, persistent sandbox for each design doc (or however else you want to partition it) and the id of said design doc would have to be passed with view protocol calls, if it isn't already.
To enforce the map/reduce semantic requirements, the view server could make the environment immutable for map/reduce calls and unlock it for init calls.
Ben Browning wrote:
I have several views that actually include some javascript libraries inline within the view outside of my map function (date.js for example). So, hopefully any sort of sandbox functionality would take this use-case into account. - Ben
