Compilers and why they are evil
I want to make something clear from the start, compiler for me is something that translates program to byte codes before I could run it. So interpreters are not compilers in that sense since they do that on the fly and I adore them.
But I hate compilers as much as I believe any other C++ programmer out there. Didn’t you ever after a quick fix which takes a second was waiting for half an hour for program to compile so you could see you was wrong and should fix just a little bit more? Isn’t it just a huge waste of time?
I know, Java advocates that it compiles much faster since it doesn’t have that much dependencies over files. That’s true. For some extend. You know, “Hello world” programs compiles instantly. But when the code grows compiling tends to become slower and slower and then ant thrown into equation which makes it a lot slower almost as slow as C++. It always happens with big projects, code is shared and you have to be sure all the parts that is using at least it compiles.
But why? Why do we have to wait? Why it couldn’t compile only the parts we are looking at much like JSP actually does? Why check everything all the time?
That’s static typing for you. Compiler want to be sure everything is correct so it has to look everywhere your changes could make the difference and it is usually huge piece of a project. When there an ant script in place it doesn’t even check and recompiles everything. Just in case. You know, better check it early as they say. Never mind it takes forever.
But it is wrong. The reason of early checks is coming from fact that later you might forget the context of the fix so you would have to spend significant amount of time to get it back. But I do forget it while this stupid compiler checks everything and I have to make myself coffee or read something since I couldn’t just hibernate. Even more, if it wouldn’t do that I fix the issue faster and still be in context if one of tests would break. Or at least as much as I am after compiling time anyway.
So it just not worth it. But you couldn’t just throw compiler away if there are static types. It just makes your classes depend on each other so you have to compile all of them. Huh, poor me.
There are another types of compiles, so called preprocessors which converts some of super set of the language to the language itself. C++ preprocessor is a simplest one I know. jwacs is pretty complex one more like a compiler. They’re usually fine except they wants me to do one more step between writing code and running application. They could easily avoid that by doing everything on demand since they work on per file basis. I really want something for JavaScript and XUL which would work like that. Maybe even converter from JSON to XUL. Need to make some modification to Thunderbird and Firefox in order to do that though.
Ok, today we learn that compilers are evil since they just stealing our time, writers of preprocessor languages too lazy to make them usable by making them work on demand, static typing sucks and dynamic languages rules. See you later!