Javascript bytecode
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Dec 19 07:44:39 PST 2012
On 12/19/12 4:25 AM, Walter Bright wrote:
> On 12/19/2012 1:10 AM, Rob T wrote:
>> Using the JS code as an example, you are stating that the JS source
>> code itself
>> could just as well be viewed as the "bytecode", and therefore given
>> what I
>> previously wrote concerning the "advantages", I could replace
>> "bytecode" with
>> "JS source code" and achieve the exact same result. Am I Correct?
>
> Yes.
I thought the claim was about ASTs vs. bytecode, which slowly segued
into source code vs. byte code. Are e in agreement there is a cost of
translating JS source code to AST format? (The cost may be negligible to
some applications but it's there.)
There's also the serialization aspect. Serializing and deserializing an
AST takes extra effort because pointers must be fixed. Bytecode can be
designed to avoid most of that cost.
On these two accounts alone, one may as well choose bytecode if it ever
needs to be read and written. Defining a strategy for pointer
serialization is comparable work.
>> Do you have a theory or insight that can explain why a situation like
>> the Java
>> bytecode VM came to be and why it persists despite your suggestion
>> that it is
>> not required or of enough advantage to justify using it (may as well
>> use Java
>> source directly)?
>
> Consider the US space shuttle design. It's probably the most
> wrong-headed engineering design ever, and it persisted because too many
> billions of dollars and careers were invested into it. Nobody could
> admit that it was an extremely inefficient and rather crazy design.
>
> A couple NASA engineers have admitted to me privately that they knew
> this, but to keep their careers they kept their mouths shut.
That's not answering the question.
Andrei
More information about the Digitalmars-d
mailing list