On Sun, Dec 5, 2010 at 8:53 AM, Johnny Weng Luu <[email protected]> wrote: > In CouchDB definitive guide the author says you could use: > > // !json templates.edit > // !json blog > // !code vendor/couchapp/path.js > // !code vendor/couchapp/template.js > > But why use those macros when you can use require()? > > Are there occasions I want to use the macros instead?
You must use macros for map/reduce view functions, because CouchDB must know every change that you make to those functions, otherwise it won't know when to update the index linked to that view. Using require would make it possible to change the behaviour of a map function without changing it's source code, by changing a require'd function. Therefore we need to resort to the more primitive mechanism of includes. Fortunately CouchApp solves that problem for us. -- Luciano Ramalho programador repentista || stand-up programmer Twitter: @luciano
