Gozala/wisp — pull request #102 by Gozala (2014-05-22 06:33:46+00:00)
Title: Make define-macro macro that outputs JS functions

This is work in progress patch. With this extension following code will produce output below it:

```clj
(define-macro unless
[condition form]
(list 'if condition nil form ))

(unless weekend? (alarm "8:00"))
```
```js
(function () {
var unless = exports.unless = function unless(condition, form) {
return list(symbol(void 0, 'if'), condition, void 0, form);
};
this['user.wisp$unless'] = unless;
return unless;
})();
isWeekend ? void 0 : alarm('8:00');
```

Only visible difference is that macro will actually compile to a JS function. This is a step towards implementing macro imports. Now what's left is to extend analyzer (or maybe compiler) so that `:require` forms from `ns` will actually be required during compilation. That way macros from those modules will actually be installed. In addition macro expander will have to be modified slightly so that it will look up macros not only in it's own hash map but rather where `define-macro` installs them: `this['user.wisp$unless']`. Finally namespace info will have to be preserved on symbols so that in the code `(unless weekend? (alarm "8:00"))` `unless` could be mapped back to either local `unless` or imported one like `my.macros/unless` which is necessary to properly resolve macros.