Nice article, but I was surprised to read that array accesses are not range checked for speed concerns. The emacs byte code interpreter is not known to be a very fast one, I doubt that the range checks would make a significant difference in run time. If anything, byte codes should bring high levels of safety.
Emacs Bytecode Internals (2014)
11–20 of 26 posts
Re: Emacs Bytecode Internals (2014)
#12"Byte-code compilation is an underdocumented — and in the case of the recent lexical binding updates, undocumented — part of Emacs" "People do not write byte-code; that job is left to the byte compiler. But we provide a disassembler to satisfy a cat-like curiosity." If I was an emacs fan I'd be weary of this. What happens if the devs are hit by busses? What happens to emacs? No documentation means very little stabili…
Of course, if you have Emacs you'll presumably also have the manuals. Chapter 16 of the Elisp manual seems pretty thorough.
Re: Emacs Bytecode Internals (2014)
#13"Byte-code compilation is an underdocumented — and in the case of the recent lexical binding updates, undocumented — part of Emacs" "People do not write byte-code; that job is left to the byte compiler. But we provide a disassembler to satisfy a cat-like curiosity." If I was an emacs fan I'd be weary of this. What happens if the devs are hit by busses? What happens to emacs? No documentation means very little stabili…
Documentation of source code is often overrated IMO. Most software isn't difficult to understand if it's at least somewhat well-structured - and when the structure is poor, documentation doesn't help much.
It's usually the application domain that's hard to understand, because that's where global invariants and assumptions live.
(Don't get me wrong: documentation of module boundaries is great, particularly if there are many users of the module, up until you get to APIs, where documentation is essential for a decent experience. Documentation of the innards of software, not so much.)
Re: Emacs Bytecode Internals (2014)
#14"Byte-code compilation is an underdocumented — and in the case of the recent lexical binding updates, undocumented — part of Emacs" "People do not write byte-code; that job is left to the byte compiler. But we provide a disassembler to satisfy a cat-like curiosity." If I was an emacs fan I'd be weary of this. What happens if the devs are hit by busses? What happens to emacs? No documentation means very little stabili…
Source code is the ultimate documentation. ;)
Re: Emacs Bytecode Internals (2014)
#15"Byte-code compilation is an underdocumented — and in the case of the recent lexical binding updates, undocumented — part of Emacs" "People do not write byte-code; that job is left to the byte compiler. But we provide a disassembler to satisfy a cat-like curiosity." If I was an emacs fan I'd be weary of this. What happens if the devs are hit by busses? What happens to emacs? No documentation means very little stabili…
Bytecode is not a novel idea and I wouldn't expect it to be difficult at all to map the well-known concepts to the particulars of the Emacs implementation. Documentation of source code is often overrated IMO. Most software isn't difficult to understand if it's at least somewhat well-structured - and when the structure is poor, documentation doesn't help much. It's usually the application domain that's hard to underst…
O-code predates it by a couple decades for general purpose compilation: https://en.wikipedia.org/wiki/O-code
Re: Emacs Bytecode Internals (2014)
#16Nice article, but I was surprised to read that array accesses are not range checked for speed concerns. The emacs byte code interpreter is not known to be a very fast one, I doubt that the range checks would make a significant difference in run time. If anything, byte codes should bring high levels of safety.
In the Java/C# word, you are expected to get some libraries or shared code distributed as bytecode, without been able to see the source code. So the bytecode must ensure safety, so an application can run untrusted code.
[I'm more familiar with Racket.] In Lisp/Elisp/Scheme/Racket word you usually don't get shared code as bytecode, you get the source code. (An executable can be actually some bytecode packaged conveniently with the interpreter/JIT, but an executable can do whatever it likes, like formatting your hard disk.) So it's enough to ensure safety in the source code.
Re: Emacs Bytecode Internals (2014)
#17"Byte-code compilation is an underdocumented — and in the case of the recent lexical binding updates, undocumented — part of Emacs" "People do not write byte-code; that job is left to the byte compiler. But we provide a disassembler to satisfy a cat-like curiosity." If I was an emacs fan I'd be weary of this. What happens if the devs are hit by busses? What happens to emacs? No documentation means very little stabili…
Re: Emacs Bytecode Internals (2014)
#18Article might need a 2014-tag.
Re: Emacs Bytecode Internals (2014)
#19Nice article, but I was surprised to read that array accesses are not range checked for speed concerns. The emacs byte code interpreter is not known to be a very fast one, I doubt that the range checks would make a significant difference in run time. If anything, byte codes should bring high levels of safety.
Re: Emacs Bytecode Internals (2014)
#20Earlier quoted context omitted.
Bytecode is not a novel idea and I wouldn't expect it to be difficult at all to map the well-known concepts to the particulars of the Emacs implementation. Documentation of source code is often overrated IMO. Most software isn't difficult to understand if it's at least somewhat well-structured - and when the structure is poor, documentation doesn't help much. It's usually the application domain that's hard to underst…
It was probably a novel application when it was first implemented in emacs 1985-ish (going by the bytecomp.el header comment by JWZ). First editor bytecode? First lisp bytecode? First interpreter bytecode? O-code predates it by a couple decades for general purpose compilation: https://en.wikipedia.org/wiki/O-code
By the time it was implemented for emacs, many, if not most CS students would have been familiar with p-code as used for UCSD Pascal etc.