Thread overview | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
December 18, 2012 Javascript bytecode | ||||
---|---|---|---|---|
| ||||
An interesting datapoint in regards to bytecode is Javascript. Note that Javascript is not distributed in bytecode form. There is no Javascript VM. It is distributed as source code. Sometimes, that source code is compressed and obfuscated, nevertheless it is still source code. How the end system chooses to execute the js is up to that end system, and indeed there are a great variety of methods in use. Javascript proves that bytecode is not required for "write once, run everywhere", which was one of the pitches for bytecode. What is required for w.o.r.e. is a specification for the source code that precludes undefined and implementation defined behavior. Note also that Typescript compiles to Javascript. I suspect there are other languages that do so, too. |
December 18, 2012 Re: Javascript bytecode | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tuesday, 18 December 2012 at 18:11:37 UTC, Walter Bright wrote: > I suspect there are other languages that do so, too. Including (a buggy, incomplete subset of) D! https://github.com/adamdruppe/dmd/tree/dtojs |
December 18, 2012 Re: Javascript bytecode | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tuesday, 18 December 2012 at 18:11:37 UTC, Walter Bright wrote:
> An interesting datapoint in regards to bytecode is Javascript. Note that Javascript is not distributed in bytecode form. There is no Javascript VM. It is distributed as source code. Sometimes, that source code is compressed and obfuscated, nevertheless it is still source code.
>
> How the end system chooses to execute the js is up to that end system, and indeed there are a great variety of methods in use.
>
> Javascript proves that bytecode is not required for "write once, run everywhere", which was one of the pitches for bytecode.
>
> What is required for w.o.r.e. is a specification for the source code that precludes undefined and implementation defined behavior.
>
> Note also that Typescript compiles to Javascript. I suspect there are other languages that do so, too.
Actually, they call JavaScript an IL for the next ten years.
|
December 18, 2012 Re: Javascript bytecode | ||||
---|---|---|---|---|
| ||||
Posted in reply to Max Samukha | On Tuesday, 18 December 2012 at 18:22:40 UTC, Max Samukha wrote:
>
> Actually, they call JavaScript an IL for the next ten years.
s/an/the
|
December 18, 2012 Re: Javascript bytecode | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tuesday, 18 December 2012 at 18:11:37 UTC, Walter Bright wrote: > Javascript proves that bytecode is not required for "write once, run everywhere", which was one of the pitches for bytecode. > > What is required for w.o.r.e. is a specification for the source code that precludes undefined and implementation defined behavior. Yes, bytecode isn't strictly required, but it's certainly desirable. Bytecode is much easier to interpret, much easier to compile to, and more compact. The downside of bytecode is loss of high-level meaning... but that depends on the bytecode. There's nothing stopping the bytecode from being a serialised AST (actually, that would be ideal). > Note also that Typescript compiles to Javascript. I suspect there are other languages that do so, too. There are lots. It's probably the most compiled-to high level language language out there (including C). |
December 18, 2012 Re: Javascript bytecode | ||||
---|---|---|---|---|
| ||||
Posted in reply to Peter Alexander | On 12/18/2012 10:29 AM, Peter Alexander wrote: > On Tuesday, 18 December 2012 at 18:11:37 UTC, Walter Bright wrote: >> Javascript proves that bytecode is not required for "write once, run >> everywhere", which was one of the pitches for bytecode. >> >> What is required for w.o.r.e. is a specification for the source code that >> precludes undefined and implementation defined behavior. > > Yes, bytecode isn't strictly required, but it's certainly desirable. Bytecode is > much easier to interpret, much easier to compile to, and more compact. Bytecode would have added nothing to js but complexity. I think you're seriously overestimating the cost of compilation. > The downside of bytecode is loss of high-level meaning... but that depends on > the bytecode. There's nothing stopping the bytecode from being a serialised AST > (actually, that would be ideal). As I pointed out to Andrei, Java bytecode *is* a serialized AST. |
December 18, 2012 Re: Javascript bytecode | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tue, Dec 18, 2012 at 10:11:37AM -0800, Walter Bright wrote: > An interesting datapoint in regards to bytecode is Javascript. Note that Javascript is not distributed in bytecode form. There is no Javascript VM. It is distributed as source code. Sometimes, that source code is compressed and obfuscated, nevertheless it is still source code. > > How the end system chooses to execute the js is up to that end system, and indeed there are a great variety of methods in use. > > Javascript proves that bytecode is not required for "write once, run everywhere", which was one of the pitches for bytecode. I never liked that motto of Java's. It's one of those things that are too good to be true, and papers over very real, complex cross-platform compatibility issues. I prefer "write once, debug everywhere". :-P > What is required for w.o.r.e. is a specification for the source code that precludes undefined and implementation defined behavior. [...] What would you do with system-specific things like filesystem manipulation, though? That has to be implementation-defined by definition. And IME, any abstraction that's both (1) completely-defined without any implementation differences and (2) covers every possible platform that ever existed and will exist, is either totally useless from being over-complex and over-engineered, or completely fails to capture the complexity of real-world systems and the details required to work with them efficiently. T -- WINDOWS = Will Install Needless Data On Whole System -- CompuMan |
December 18, 2012 Re: Javascript bytecode | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | There is Emscripten which compiles LLVM to javascript, so you could probably get D into JS like that also https://github.com/kripken/emscripten |
December 18, 2012 Re: Javascript bytecode | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 2012-12-18 19:11, Walter Bright wrote: > Note also that Typescript compiles to Javascript. I suspect there are > other languages that do so, too. CoffeeScript and Dart to mention two other languages that compile to JavaScript. -- /Jacob Carlborg |
December 18, 2012 Re: Javascript bytecode | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tuesday, 18 December 2012 at 18:11:37 UTC, Walter Bright wrote: > An interesting datapoint in regards to bytecode is Javascript. Note that Javascript is not distributed in bytecode form. There is no Javascript VM. It is distributed as source code. Sometimes, that source code is compressed and obfuscated, nevertheless it is still source code. > > How the end system chooses to execute the js is up to that end system, and indeed there are a great variety of methods in use. > > Javascript proves that bytecode is not required for "write once, run everywhere", which was one of the pitches for bytecode. > Well, my experience is more like write once, debug everywhere. For both java AND javascript. > What is required for w.o.r.e. is a specification for the source code that precludes undefined and implementation defined behavior. > Isn't safeD supposed to provide that (as long as you never go throw trusted code) ? > Note also that Typescript compiles to Javascript. I suspect there are other languages that do so, too. Most thing can compile to javascript. The MOTO right now seems to be that if you can do it in javascript someone will. It don't mean someone should. |
Copyright © 1999-2021 by the D Language Foundation