Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't the compiler just compile my code as I type it?

Why can't the compiler just compile my code as I type it?

From the user's point of view, it could work as smoothly as syntax colouring does today. If you stop typing for long enough (maybe a couple of seconds) the compilation (not linking) would finish, and code errors would be identified using something like syntax colouring.

It's not like my 3GHz quad core monster computer was really busy doing something else. Why not let it compile all the time?

like image 790
Rocketmagnet Avatar asked Sep 14 '10 21:09

Rocketmagnet


2 Answers

That's exactly what the VB.NET code editor in Visual Studio does.

The advantage is much more accurate IntelliSense than C#. The disadvantage is that it wastes truly vast amounts of processor time and memory. :-(

like image 196
Christian Hayter Avatar answered Nov 18 '22 13:11

Christian Hayter


It can. Or, to be more useful, the answer to this question depends on

  1. What language
  2. What degree of optimization you require
  3. How annoyed you will be if you temporarily type something dumb, and the compiler compiles and injects the result into the binary your are debugging before you can fix it.

Some really strong optimizations would be very messy to mess with on the fly. On the other hand, a basic compilation, if there's no need to worry about assigning offsets for X86 instructions? Sure.

like image 5
bmargulies Avatar answered Nov 18 '22 12:11

bmargulies