Hi all,
Many thanks for the replies. I am glad that
you have taken the time to consider my idea.
I hope I am not breaking netiquette here by
answering two posts at once. I have credited
each author.
David Lee Lambert wrote:
> First of all, it may actually take several thousand
> instructions to process each keystroke, or even more.
Yes, of course. Let's be conservative, and say it takes
one million instructions. That still leaves 199,000,000
instructions for thumb twiddling. And that's if I type
extremely fast. If I take a moment to think, or rest my
weary fingers, the compiler may have 3x10^10 instructions
to play with, or more.
David Lee Lambert wrote:
> At every point before the end of main(), a normal C++ compiler would
> complain about a parse error (unmatched '{' ).
That's ok. Nobody would expect the compiler to work miracles.
On encountering such a glaring error in the code, it would simply
stop parsing, and highlight the error. Why wait until I press F7 (or
whatever) to point out such a glaring mistake.
This is similar to the behaviour of an IDE with syntax colouring.
When I type a /* all of the code after is turned immediately into
the colour of a comment. This is not what I had in mind, but as
soon as I type the */ the colouring is fixed.
David Lee Lambert wrote:
> I'm not sure if these are insurmountable difficulties; for instance,
> the editor could automatically add a phantom '}' to match each '{', a
I don't think the compiler should type your code for you. That's
surely some kind of AI problem. It need only wait patently, colouring
the line as you type it, and restarting the compilation when the cursor
leaves the line.
David Lee Lambert wrote:
> I find that fancy doodads in editors are sometimes useful, but other
> times they can be downright distracting, and I'm glad emacs allows me
> to turn stuff like that off.
Of course, that should always be an option. You needn't
see any of this information in real-time. But would you choose
to disable essentially instant compiling, and deeply informative
syntax colouring?
grey wolf wrote:
> in the Eclipse platform with the C/C++ extensions, you can configure it
> to do exactly that - each time you save your work . . .
>
> this is great for small projects, but when your source files grow to
> hundreds upon hundreds of lines and the time required to compile one of
> them starts reaching into the minutes, this quickly grows tiresome and
> counterproductive.
This is almost what I had in mind, but not quite. The difference
is what you have highlighted: that the compile time can be very
slow for large projects. I imagine that, after every save, you
have to wait for the compile to complete before you can continue
typing? If that is the case, then I can imagine it totally ruins
the coding experience.
What I am suggesting is a tool which would never waste more of
your time than a conventional IDE+compiler, and may well save
a great deal of time.
It simply makes use of the available time, constantly and invisibly
restarting chunks of compilation as it needs to. To the user, it
would simply look like a super syntax colourer, plus very short
compile times.
grey wolf wrote:
> what you're asking for here is well outside the scope of the IDE -
> you're now talking about an interactive compiler suite that can
> dynamically compile units at the function level rather than at the unit
> (or object) level.
Now, this is where I show off my ignorance of the innards of a compiler.
I always assumed that, at some point, a compiler would have to consider
non-inline functions on their own, without considering other functions
at the same time. Can anyone clarify this?
There must be some amount of work that can be done to compile and
optmise a function in isolation.
At the very least, it could be compile whole units that you are not
currently editing. Often, I make changes to several units. The compiler
could begin compiling one of those as soon as you switch to a different
source window, and stop if you begin editing it again. Hmm, I wonder if
this can be done with eclipse?
grey wolf wrote:
> your idea is an interesting one - but you seem to be confusing the
> jobs of an IDE with that of a compiler ... [cut] ... the IDE has no
> place taking over the _JOB_ of a compiler any more than the compiler
> should have anything to do with a text editor.
Yes, I am talking about an *Integrated* Development Environment,
where the compiler has also been integrated too.
I am fully aware that currently the jobs of the editor, compiler,
linker and make are all separate. But this is not a law of physics,
and there is no confusion.
Once, for example, mechanical CAD software and Stress FEA tools
were separate applications, now you can get CAD with integrated
stress analysis, which makes the engineer more productive. PCB
layout tools, and FPGA firmware authoring tools were separate,
but intergrating them allowed the PCB autorouter to help optimise
the usage of the FPGA pins to make more efficient routing.
In this case, bringing the expertise of the compiler into the
coding might have great productivity gains.
> such a compiler would be overly complex, prone to a
> great deal of internal compiler bugs, and would most likely output very
> poor-quality object files.
I agree that the compiler would be more complex, but I don't
see why this particular feature should introduce relatively
more bugs than any other advanced feature. I can imagine people
saying that an optimising compiler had no place optimising your
code for you, and would be buggy, back when someone first suggested
it.
I also don't see that the compiler should produce code that is
in any way different to that which it would produce by compiling
all at once. But that view may come from my ignorance.
The payoff would be if such a tool could dramatically improve
the productivity of programmers, and perhaps even improve the
quality of their code. The best time to catch a bug is at compile
time. Let's have more compile time!
Sadly, this is as far as I go. As is often the case, my dreams far
outshine my talents. Rather than lamely suggesting it, I would
normally just go ahead and do it, as I am currently doing for a
similar idea I have for a tool for editing PCBs. Watch this space.
Many thanks for your patience if you have read this far.
Also, thanks grey wolf, I'll go and check out eclipse. I am
looking for a new IDE at the moment.
Hugo Elias