musictheory / NilScript

Objective-C-style language superset of JavaScript with a tiny, simple runtime
Other
50 stars 5 forks source link

Connect/Express middleware for .oj -> .js? #24

Closed IngwiePhoenix closed 9 years ago

IngwiePhoenix commented 9 years ago

I am working on a bigger project, and for readability reasons, I very much prefer Objective-C's syntax. To increase that for my project, I thought about creating a middleware to translate incoming file.oj requests into a call to a compiler function and save file.js - then send that one back isntead.

Would you say that this is do-able, and more, useful?

Kind regards, Ingwie

iccir commented 9 years ago

There might be some issues with having each .oj file output to a .js file, at least in the upcoming version 1.0. --inline-enum, --inline-const, and --squeeze are all compiler options that want to operate on the source base as a whole (or at least in very large chunks). What you could do is have your middleware check timestamps of the output .js file, the input .oj files, and then concatenate and compile all of them at the same time.

On my machine, a recompile of all 150 .oj files in my company's project takes about 2 seconds.

IngwiePhoenix commented 9 years ago

I thought about a similar aproach - and now I have confidence that I will actually do it!

Thanks for the response, it helps a lot.

Am 28.10.2014 um 08:22 schrieb Ricci Adams notifications@github.com:

There might be some issues with having each .oj file output to a .js file, at least in the upcoming version 1.0. --inline-enum, --inline-const, and --squeeze are all compiler options that want to operate on the source base as a whole (or at least in very large chunks). What you could do is have your middleware check timestamps of the output .js file, the input .oj files, and then concatenate and compile all of them at the same time.

On my machine, a recompile of all 150 .oj files in my company's project takes about 2 seconds.

— Reply to this email directly or view it on GitHub https://github.com/musictheory/oj/issues/24#issuecomment-60718081.

iccir commented 9 years ago

I think I can close this? Feel free to reopen if you have questions!