Arc Forumnew | comments | leaders | submitlogin
2 points by almkglor 6148 days ago | link | parent

A (with ...) form is just a module by another name. Heck, ECMAscript "modules" are done exactly like Arc "modules" would be made:

  MyStuff = (function(){
    var modulevar;
    function innerfunction(){...}
    function exportedfn(){...}
    return {exportedfn: exportedfn}})();
which is practically the same code as:

  (= MyModule
    (let (modulevar innerfunction exportedfn) nil
         (def innerfunction () ...)
         (def exportedfn () ...)
         (fill-table (table) 'exportedfn exportedfn)))
However, suppose we instead had a macro, named 'module, which supported the following syntax instead:

  (module MyModule
    (module-var modulevar)
    (public exportedfn)
    (def innerfunction () ...)
    (def exportedfn () ...))
The above strikes me as being shorter and having much fewer parentheses, as well as eliminating quite a bit of boilerplate.