Re: Java speed: Reality versus theory?



In article <MVPcf.137840$Io.49365@clgrps13>,
Oliver Wong <owong@xxxxxxxxxxxxxx> wrote:
>
>"MSCHAEF.COM" <mschaef@xxxxxxxxxxxx> wrote in message
...
>> That's the C code that has to get compiled. It 'came from' C++, via a
>> running copy of CFront, so to speak. In otherwords, CFront is a C++
>> program that can compile itself.
>
> I must admit, I don't really understand this. I'll try to paraphrase it,
>and it'll lead to a paradox, and you can tell me where my misunderstanding
>is, okay?
>
> 1) Previously, there did not exist a C++ compiler.
> 2) Someone wrote a program called "CFront" in the C++ language.
> 3) They than ran "CFront" on itself to produce C code. (What the...? How
>did they run it without compiling it?)
> 4) They than compiled the generated C code to make an executable.
> 5) They than ran this executable on "CFront" to compile it. (Some sort
>of time travelling trick?)

If you're writing a compiler for a totally new langauge, you have two
options:

* Write your compiler in the new language and then manually translate it
to a language you can actually run.

* Write a compiler for your new langauge in a langauge you can already
run.

A refinement of option 2 is you write a compiler for a subset of your new
langauge in an existing language. You can then use that to bootstrap your
real, self-hosting compiler.


>>> That is correct. But if you're implying "Sun *SHOULD* write their Java
>>>compiler in Java" or something like that, I don't see why.
>>
>> Simple, it sets up the correct incentives.
>
> I don't understand your answer. What does it mean to "set up" an
>"incentive"?

Microsoft has done this for a long time, but the Windows NT team made it
most public. The theory was pretty simple: by integrating Windows NT into
the Windows NT development process, WinNT developers would have more
reason to make their stuff as stable and as reliable as possible.

If the Java compiler team spends all their time coding the
compiler/toolchsin in C, and test programs/etc. in Java, then are they
really capable of making decisions about how the language is used in large
scale systems? It's easy for me to unfairly second guess their choices,
but I do wonder.

> And what does it mean for an incentive to be "correct"?

That's a matter of opinion. What I meant was that I want to use languages
good enough that their designers and implementors want to use them too, in
their daily work. That way, the pain I feel using their product, they
feel. The ease of use I experience using their product, they experience.


-Mike
--
http://www.mschaef.com
.