pugjs / then-pug

**EXPERIMENTAL** Async promise based Jade
42 stars 5 forks source link

compiler inheritance #5

Closed jeromew closed 10 years ago

jeromew commented 10 years ago

@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 !

ForbesLindesay commented 10 years ago

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.

jeromew commented 10 years ago

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 !

jedireza commented 10 years ago

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