3 ms·
JavaScript is really easily "openable." It's actually really easy to run most of it through a beautifier. Take even something as insane as the contents of http:
by striking 12y ago
JavaScript is really easily "openable." It's actually really easy to run most of it through a beautifier. Take even something as insane as the contents of http://jsbin.com/OhisIQAW/1/source http://jsbin.com/OhisIQAW/1/source (uses nothing but symbols to run `alert("I love you.")`) and the magic becomes a lot more visible.
Running the first statement will give you an object filled with numbers 0-9 and letters a-f. The second statement, when run, outputs the string "constructor" by messing with references to the first object.
With a little bit of dedicated work, you can easily learn how anything is done in JS (well, besides Asm.js but that's beside the point) because it is, at its highest level, a language made to bridge between APIs. The only good thing about it is its widespread support and debuggability.
Oh, and the reasoning behind the "one character method names" mentioned: It's for minification of code, because we don't live in a world with infinite resources. If the FSF donated to me to keep my code "open" then I'd gladly keep it un-minified. Even when "obfuscated", though, it's pretty trivial to undo. [1]
[1]: http://features.jsomers.net/how-i-reverse-engineered-google-docs/ http://features.jsomers.net/how-i-reverse-engineered-google-...
- TazeTSchnitzel 12y agoEven asm.js is openable, it's pretty much just C with weird syntax - despite the name. Although almost all your type info's gone, which makes interpreting it a wee bit hard.
- mambodog 12y agoNot exactly, it's more like LLVM IR with a weird syntax[0] [0] http://llvm.org/devmtg/2013-11/slides/Zakai-Emscripten.pdf http://llvm.org/devmtg/2013-11/slides/Zakai-Emscripten.pdf
- TazeTSchnitzel 12y agoAh, true. Although asm.js code is probably more C-like than LLVM IR is, given you have to decompile gotos back into ifs and loops, operations back into expressions, etc. (See page 23 onwards)
- streptomycin 12y agoFree software isn't about the freedom to somehow look at code. https://www.gnu.org/philosophy/free-sw.html https://www.gnu.org/philosophy/free-sw.html
- striking 12y agoAlmost all JavaScript is easily changeable and replaceable and oftentimes being able to figure out what it's doing is a matter of intuition and a little imagination. Even the code of Google Docs isn't really that hard to understand if you tilt your head and squint a little. Obfuscation of C or otherwise native code can prevent people from modifying it or learning from it, and that is a problem to some people. However, that doesn't seem to exist in my view of JavaScript. It has never been a real problem as far as I have seen. I am open to seeing examples that I truly could not understand.
- Retra 12y agoWell soldier on and rewrite all the javaScript on the web already.