Harmony as a Compilation Target of my Dreams

Kris Kowal kris.kowal at cixar.com
Tue Feb 8 13:21:28 PST 2011

This is a half-baked idea. Harmony of Brendan's Dreams makes extensive
use of new octothorp syntax. There is perhaps another use for
octothorp prefixes: to annotate generated JavaScript with line numbers
from the source.

    number -= 42 if opposite
    square = (x) -> x * x


    var opposite, number, square;
    #1 if (opposite) { number -= 42; }
    #2 square = function (x) { return x * x; }

This would require some form of annotation to connect the line numbers
with the corresponding source code.  The connection could be inferred
easily given the tacit strawman for Module(text, fileName, lineNo) and
I imagine that some similar annotation would be possible on or around
a module keyword.

It might even be useful to implicitly increment the annotation line
number on line breaks to reduce the verbosity so that minifiers can
provide similar annotation at little cost.

A third use-case would be annotating the sources of statically bundled
"Simple Modules" or whatever succeeds them. I imagine that there would
be a need for tools that transform load directives into inline
modules, so it would be handy to annotate sources for debugging in
that case too.

Kris Kowal

More information about the es-discuss mailing list