pugjs/then-pug

compiler inheritance

jeromew opened this issue · 3 comments

@ForbesLindesay l saw that you chose to leave the pretty_indent code intact. It seems indeed a good choice to limit diff.

Looking again at the code, I wonder if we could not lower the work of synchronizing the 2 repos by adding 2 properties to jade compiler :

this.functionCallOp = '';
this.functionDefinitionOp = "function";

In the inherited version these would become

this.functionCallOp = 'yield* ';
this.functionDefinitionOp = "function*";

there would be no ìf`in the code, it would stay readable, and above all there would be less room for a human error while backporting the jade modifications;

Do you want me to PR a proof-of-concept of this on jade so you can see what the full diff would look like ? If you have better names for the properties, don't hesitate !

I think, for now, I want to minimise the impact of this on the core jade repo. We can have some pretty good tests in this repo, which will go a long way towards preventing the errors. If this fork of jade gains in popularity, we can start adding things to jade-core to support it.

Ok I understand.
The impact would be very low imho, and only on lib/compiler.js.
I have yet to see if I am the only one in need of a streaming jade !

I think streaming jade would be great. I bet more people would too if they knew it existed/would-exist.