32 ms·
I hope DOM access comes very close on the heels of the initial design... Javascript is an interesting language (particularly after it's recent revival), but IM
by warbiscuit 10y ago
I hope DOM access comes very close on the heels of the initial design...
Javascript is an interesting language (particularly after it's recent revival), but IMO it's recent jumpstart would never have happened if it weren't for one killer feature: access to the HTML DOM. People would (and have) forgiven many other things, just for the utility of that as the presentation layer.
I certainly would have picked up whatever language the browsers were pushing, where DOM access was a requirement.
Conversely, I remember trying to get java applets to interact with HTML -- you have to message things through a tiny hole to/from javascript; which was (one of the many) things which made everyone hate java applets.
- megalodon 10y agoI just hope that when it happens we will be able to view and read the source of WASM in the same way we can with javascript now. This is one of the foundations of WWW, please don't turn it into a closed source app store.
- gsnedders 10y agoWe lost that years ago with minification. Source maps can work as well for WASM as they can for minified JS.
- kuschku 10y agoThen make browsers require full source maps for every website, or refuse to run them. That’d be finally a solution. Or require source maps by law. EDIT: Why the downvotes? The only way to preserve the right to modify and decompile in the long term is by creating technical or legal measures enforcing it. JS was one technical measure, so now we need alternatives.
- jfbastien 10y agoThat would be awfully slow to transfer (or just verify) when most people never view the source map. What's a "valid" source map anyways? Furthermore, debugging with sourcemaps is suboptimal. WebAssembly wants to support much better debug information than this.
- gsnedders 10y agoAnd it'd imply you need a source map even with unminified JS. And what's to say the source map maps to non-minified JS?
- kuschku 10y agoIt’s not about debugging, it’s about the legal "right to decompile", which is intended to give customers and companies the right to take apart products and software they bought (even from competitors), and gain knowledge from that. It’s also intended to allow them to modify it for their own purposes, and provide the modifications to others who have a license to the original product. Especially on the web this was finally possible, and now you’re suggesting to take this away again?
- rabbitfang48 10y agoI know of no country (or other jurisdiction) where a legal "right to decompile" exists.
- gsnedders 10y agoThe EU has a very, very limited right to decompile for the sake of interoperability. See Article 6 on http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:31991L0250:EN:HTML http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:...
- kuschku 10y agoAnd for personal modifications, and so on. And "copying the decompiled source of the part of MS Word that reads .doc files" counts as covered, so, it's quite a lot. Especially with websites, where you might want to interact with, or write addons interacting with, WASM threatens those rights.
- vidarh 10y agoMany countries allow reverse engineering, and you could infer a "right to decompile" from that in some cases, but as far as I know none of them place any requirement on the source to make it easy. At most they legally protect someone who decides to run a disassembler or decompiler on a binary from prosecution or lawsuits (but only in as much as you don't use the result to violate copyright or other restrictions).
- pcwalton 10y ago> Then make browsers require full source maps for every website, or refuse to run them. > That’d be finally a solution. No, it wouldn't. You'd end up with sites shipping "source maps" that map every function to a randomly generated identifier.
- megalodon 10y agoYou seem to know a bit about web standards, was minification ever formally accepted by the W3C or did it just happen?
- gsnedders 10y agoJust happened. It's just renaming variables and properties, after all—there's no actual change to anything standardised. As an aside, JS is standardised by Ecma, as ECMAScript: the W3C doesn't have anything to do with it.
- comex 10y agoIt depends what you mean by "access". The MVP won't have direct DOM access, but it's not really necessary. WebAssembly code can synchronously and efficiently call JavaScript functions (with numeric arguments), so it should be pretty easy to write a WebIDL-based stub generator to provide natural syntax for calling DOM functions from any given compiled language, with a little JavaScript stub on the other end. A future spec might make things more efficient by providing direct access, but it's really a micro-optimization.
- pcwalton 10y agoWell, the tricky part is not getting the basic FFI to work but getting the memory management right. Making sure that DOM nodes that are not part of the document stay alive and that dead nodes die is the hard part, especially if JS/wasm cycles are involved. (This is not a criticism of wasm, by the way. It's merely motivating potential future GC extensions to the spec.)
- bluejekyll 10y agoHow does that differ from today? Don't all rendering engines have to deal with that GC now?
- kabes 10y agoStep 1) Replace the 2d library of your desktop GUI language to draw using HTML canvas API. Step 2) Compile to wasm No need for the DOM anymore... (not saying it's a better approach, but it is technically possible).