Single file, quick compile option

Topics: General
May 8, 2014 at 7:32 AM
My apologies if this has come up before, but I wasn't able to find it in another discussion.

I was thinking it would be handy in large projects if a single file could be compiled in "quick mode". The compiler would simply remove the type definitions, do the straightforward conversions for classes, enums, etc. It wouldn't attempt to load any external files.

I think the transformation described above would be possible under the current language spec, although I don't know about future plans.

It would be nice when working on a large codebase, as I could do quick change / test iterations, and just kick off a more complete re-compile when necessary. For instance, I made a change and I want to figure out what I need to update, or I'm about to push code and want to make sure everything is still green.

The cool thing about the "quick compile" mode is that I could write a script loader for node that would, when a file is required during development, check whether it needs to be re-compiled. If it's out of date, it could kick off the quick compile and load it on-the-fly. That would make change / test cycles pretty fast and smooth (especially for those not using VS).
Coordinator
May 8, 2014 at 5:38 PM
We've talked about this on and off. In theory, it'd work like you say. You'd just have a "binding" pass rather than a full typecheck.

Like you say, this could be very handy when working with codebases that don't change often, or that you know what necessarily be affected by small changes in a way that it must be fully typechecked.

There are a couple of questions around when/if such a mode might be automatically enabled, but I think the general idea is pretty good and one that I think larger projects would end up using.