News for hackers. Stuff that matters.
Re:WebAssembly Specification Prototype by dccoolgai on Wednesday July 13, 2016 @05:19PM (#12089749)
I can't wait until the first time I have to maintain something someone compiled into this monstrosity. The minimal performance gains will be so worth destroying the debuggable web.

Sorry for the snark, but watching this slow-motion trainwreck plow into the Open Web that I love is excruciating.

Pre-edit to respond to the inevitable "But you already can't read and debug minified JS": yeah, you actually can if you're good enough. I do it all the time... my complaint is that the bar for "good enough" is being moved from "can read and debug scripting language" to "can read and debug Assembly"... which I know you can do, but geez. I guess what I'm saying is the Open Web should only run on (reasonably) readable languages. Hate JS? Stand in line, but if you want to replace it on the web, replace it with something a normal person could interpret without a compiler.

Re:WebAssembly Specification Prototype by JasonSage on Wednesday July 13, 2016 @05:44PM (#12089916)
This is a popular negative remark when it comes to WebAssembly, and I'm getting a bit disappointed at how often it comes up. We really need to get past the flood of comments on having an assembly for the web. They're usually uninformed and opinionated (a bad combination), and do nothing to help real efforts that are in place to combat what they're complaining about.

Check the GitHub pull request below (linked from the article we're commenting on...). The WebAssembly spec includes a work-in-progress Text Format specifically to make it readable by JavaScript developers:

> This proposes an official text format for WebAssembly, aimed at browsers to use in "View Source", debugging, and related tooling. It uses a JavaScript-like syntax for readability and familiarity on the Web, though it differs from JS in several respects, as it aims to reflect the underlying WebAssembly language.

https://github.com/WebAssembly/design/pull/704

If you're strongly opinionated about WebAssembly having a readable format for the Open Web (and it would seem that many are with the volume of comments like this), then subscribe to this pull request. You'll have an opportunity to see the text format take shape and provide input on it. Developers are not oblivious to the number of subscribers on a PR or issue, so you'll also be making it known that it's important enough for you to be looped in on.

Please check out the Text Format pull and related links so that you can be informed about this issue.

edit: formatting

Re:WebAssembly Specification Prototype by dccoolgai on Wednesday July 13, 2016 @06:30PM (#12090196)
Thanks for the link to that PR. That's good advice. The truth is, it's hard for me to read what they are recommending as the readable version. Maybe that makes me an idiot...certainly a lot of comments in this thread are suggesting that's the case... but I bet I'm not the dumbest guy who codes for the open web... so for that other guy I'm sharing my opinion, misinformed as it may be.
Re:WebAssembly Specification Prototype by jacobolus on Wednesday July 13, 2016 @08:20PM (#12090833)
Have you considered that there could be use cases where the performance gains are not trivial? For some code, we’re talking about more than an order of magnitude speed difference.

What kind of language target would you prefer for running optimized numerical algorithms? Or do you just think we should keep computational photography, natural language processing, physics simulation, 3d graphics rendering, game AIs, etc. off the web?

Remember, to make their code run at full speed, developers need the ability to use a variety of numeric types and processor-specific instructions (e.g. SIMD), implement low level data structures, precisely manage memory, etc.

Even if these numerical algorithms get written in “plain” Javascript, after being minified they become essentially unreadable. Often to understand even an extremely clearly written implementation full of nice explanatory comments requires reading the technical paper alongside the code. If you’re not only missing the paper, but also have nonsense variable names and no comments, deciphering the code becomes an incredible chore. As such, I don’t think WebAssembly will have any significant effect on readability. Have you tried reading and understanding asm.js output from Emscripten? That’s what we have today, and it’s definitely worse than wasm.

Re:WebAssembly Specification Prototype by diamondlovesyou on Wednesday July 13, 2016 @06:06PM (#12090039)
Asm.js is hardly human readable; which is rather the point (not sure why this is so highly coveted, since we use source code for this purpose and the minification counter argument is nonetheless true just as it is for Wasm, but I digress). And you can debug text wasm, if you're good enough.

I'm sorry, and with all due respect, your argument is hilarious, NIMBY, and goes against the Open Web movement's goal of "...a special role for public, cooperative, and standard World Wide Web communications", which you claim to love, and I assume, support (as do I). Wasm has a required text format in the spec itself, expressly for individuals such as yourself, so wasm is still for the Open Web.

Re:WebAssembly Specification Prototype by pcwalton on Wednesday July 13, 2016 @06:47PM (#12090316)
> But you already can't read and debug minified JS

How about "but you already can't read and debug minified Emscripten output"?

Re:WebAssembly Specification Prototype by kowdermeister on Wednesday July 13, 2016 @09:56PM (#12091195)
Many years ago I added a feature (image upload button) to a minified WYSIWYG editor code without prettifying it :)
Re:WebAssembly Specification Prototype by aidenn0 on Wednesday July 13, 2016 @11:30PM (#12091468)
And I know someone who modified the MS MPEG-4 Version 3 codec to use SIMD instructions for the RGB/YUV colorspace transform, which both sped up and improved the accuracy of it. We can all agree that source-code is more readable than binary code though.

That being said, as there are already many languages that compile down to non-human-readable javascript (Including C), it's fairly moot at this point anyway.

Re:WebAssembly Specification Prototype by kevinwang on Wednesday July 13, 2016 @05:33PM (#12089832)
Would this be any different than debugging code currently written in a language that compiles to asm? For example, people debug C code, compiled to asm, on their computers. Would it be different to debug C code, compiled to webassembly, in a browser?

Although I can't disagree that debugging js directly in browser tools is a nice experience.

[dead]
Re:WebAssembly Specification Prototype by sctb on Thursday July 14, 2016 @04:06PM (#12096798)
> Rockstartup Cowboys on HN

This isn't conducive to a civil discussion on the subject. Please don't.

Re:WebAssembly Specification Prototype by jfbastien on Wednesday July 13, 2016 @05:50PM (#12089948)
We're quotidian schmucks as well. We've thought about you :)

I mostly write C and C++ code, and if someone tries to give me hand-written assembly they better have a good reason (and sometimes they do!). Same goes for wasm: it's meant as a compiler target, not something humans write by hand. That's no different from all the compile-to-JS languages, asm.js, or any assembly.

Sure Joe Schmuck can still get stuck with angry assembly, but we haven't made the world a worst place in that respect.

And I'd argue wasm is making the world better in many other ways. :-)

Re:WebAssembly Specification Prototype by fizzbatter on Wednesday July 13, 2016 @08:36PM (#12090902)
Yea i'm quite lost. It sounds like the complaint is that this person only has a binary.. but that is exactly the same as every other language.

If some company works with C# making GUI apps and then leaves on a deal, and the only thing left is a binary of the app.. no source code.. no sane person is going to touch that. Same thing for WASM.

Though, there is a text spec, but ignoring that of course.

Even for an "open web", if the OP's argument is that many individuals are leaving without source code, and all he/she is left with is to copy the minified javascript from the page and abstract meaning from that non-commented non-formatted and non-named code.. holy hell, i would not want to have OPs job. Especially if that is a common occurrence.

Give me the source code. I don't care if it's C or Javascript or HTML. Is this unreasonable?

Re:WebAssembly Specification Prototype by douche on Wednesday July 13, 2016 @09:19PM (#12091073)
With C#, as long as you don't go out of your way to run it through an obfuscator, you can generally decompile the bytecode into something that is pretty trivial to understand. I do this all the time with poorly documented Microsoft SDKs.
Re:WebAssembly Specification Prototype by azakai on Thursday July 14, 2016 @12:18AM (#12091598)
The web is different than other platforms, though.

It has a culture of people viewing source and tinkering. Minification etc. limit that, but do not eliminate it.

And the web is a medium for transmitting and running other people's code on your machine in a safe way, and that includes not just sandboxing but also being able to inspect it.

It's important that the wasm text format be as readable as possible, to continue these traditions, even if wasm is a compiler target.

Re:WebAssembly Specification Prototype by Narishma on Thursday July 14, 2016 @01:04AM (#12091738)
The equivalent of WebAssembly isn't minified JS, it's the JS output of compilers like emscripten. Is that really readable by the average JS developer?
Re:WebAssembly Specification Prototype by azakai on Thursday July 14, 2016 @10:34AM (#12094128)
Perhaps less, but I would argue that WebAssembly should aim to be no less readable than that.
Re:WebAssembly Specification Prototype by jfbastien on Thursday July 14, 2016 @01:46PM (#12095868)
I don't think you know much about emscripten. /trololol
Re:WebAssembly Specification Prototype by corysama on Wednesday July 13, 2016 @05:50PM (#12089947)
I'm having a hard time following your example. Relating it back to traditional web dev, it sounds like you've experienced developers leaving your team, taking the original JS/Coffeescript/whatever source with them and leaving you with the Closure Compiler minified JS to move forward with the project. Is that something that actually happens? That sounds like grounds for an IP lawsuit. Because that's equivalent to what you are describing in your WASM hangover example.
[dead]
Re:WebAssembly Specification Prototype by coldtea on Thursday July 14, 2016 @05:33AM (#12092582)
Yeah, and sometimes a dog eats your homework.

Back on earth though, all those things don't make sense, and are so rare as to be statistically insignificant.

In any case, not a valid argument to make against a new language/delivery format, any more than "what if someone drops it off some building and kills passers by" is an argument against pianos.

>If nothing like that ever happened to you... well I hope it never does, friend.

And if something like that ever happened to you, then maybe consider it an outlier experience, and don't extrapolate on that?

It's like an airplane accident survivor going on about how flights should be banned.

Re:WebAssembly Specification Prototype by todd3834 on Wednesday July 13, 2016 @05:49PM (#12089945)
In this scenario you are going to have to maintain the binary code without having the original source code that generated it? My understanding is that you would maintain the cleaner non binary version, am I understanding this wrong?
Re:WebAssembly Specification Prototype by coldtea on Thursday July 14, 2016 @05:30AM (#12092573)
>Pretend the relationship with the initial developers went sour (as is often the case)... and you're left with this steaming pile of binary WASM

Yeah, hardly a real world use case.

And if a company ever has it, this would point that they have far bigger problems than being left without the source code for their service...

Re:WebAssembly Specification Prototype by mozumder on Wednesday July 13, 2016 @08:11PM (#12090795)
Wut?

Why would you not have the source code to your site that you're debugging?

Re:WebAssembly Specification Prototype by dekimir on Wednesday July 13, 2016 @06:20PM (#12090135)
There is an effort under way to ensure wasm debugging is at least as easy as JS debugging: https://github.com/WebAssembly/design/pull/708
Re:WebAssembly Specification Prototype by kin on Wednesday July 13, 2016 @08:09PM (#12090779)
The performance gains are going to be massive. All of the browsers collectively demo'd this: https://webassembly.github.io/demo/
Re:WebAssembly Specification Prototype by coldtea on Thursday July 14, 2016 @05:26AM (#12092556)
>Pre-edit to respond to the inevitable "But you already can't read and debug minified JS": yeah, you actually can if you're good enough. I do it all the time...

Even if you "do it all the time" there's like zero motive to do it for third party sites and services.

Does anyone (for the statistically significant meaning of "anyone", e.g. more than some lone outliers) seriously debugs and/or monkeypatches third party sites?

And of course for your own site, you already have the code.

So I'm not sure what you're losing here.

Re:WebAssembly Specification Prototype by justinpombrio on Wednesday July 13, 2016 @11:04PM (#12091401)
There's something fishy about this argument... why doesn't it apply to the desktop? Would it be better if all desktop software was written in JavaScript, enabling debuggability in exchange for performance?
Re:WebAssembly Specification Prototype by aidenn0 on Wednesday July 13, 2016 @11:27PM (#12091457)
At that point you might have something like the lisp machines. I've not used one, but have heard more than one person talk about the very good debugging experience on them.
Re:WebAssembly Specification Prototype by randyrand on Wednesday July 13, 2016 @09:05PM (#12091023)
Webassmebly is just as debuggable as minified JS. So what are you on about?
Re:WebAssembly Specification Prototype by SquareWheel on Wednesday July 13, 2016 @06:06PM (#12090040)
A text format will be delivered alongside the binary for debugging. It will be exactly as debuggable as Javascript is (very). Please research the subject before posting kneejerk reactions.
[dead]
Re:WebAssembly Specification Prototype by SquareWheel on Wednesday July 13, 2016 @06:25PM (#12090162)
You mean the temporary S-Expression syntax? Because that's not how the final version will look.

https://youtu.be/RByPdCN1RQ4?t=1714

And from their FAQ:

>Will WebAssembly support View Source on the Web?

>a specific goal of the text format is to allow developers to write WebAssembly modules by hand for testing, experimenting, optimizing, learning and teaching purposes. In fact, by dropping all the coercions required by asm.js validation, the WebAssembly text format should be much more natural to read and write than asm.js.

https://github.com/WebAssembly/design/blob/master/FAQ.md#wil...

Now I didn't mean to come off as snippy and for that I do apologize, but I find it frustrating when people attack a project without understanding what it is they're criticizing. If you had asked "Does this pose a threat to the open web?", I think this would have been a much more productive exchange.

Re:WebAssembly Specification Prototype by pcwalton on Wednesday July 13, 2016 @06:46PM (#12090308)
A lot better than Emscripten output, which people are using today.

If you succeed in derailing Web Assembly, then you'll just have people shipping Emscripten output, and "View Source" will be worse off.

Re:WebAssembly Specification Prototype by joshkpeterson on Wednesday July 13, 2016 @05:34PM (#12089848)
"Open and debuggable: WebAssembly is designed to be pretty-printed in a textual format for debugging, testing, experimenting, optimizing, learning, teaching, and writing programs by hand. The textual format will be used when viewing the source of wasm modules on the web."[1]

What would you like to see happen here? Maybe you should give them your input.

1. https://webassembly.github.io/

Re:WebAssembly Specification Prototype by dccoolgai on Wednesday July 13, 2016 @05:47PM (#12089934)
It's Assembly, hombre. In my class of like 40 kids in college I remember one who really like to read and code in that. Maybe you are that guy - and more power to you... but the web has to work for the other 39 of us. That's what WASM is taking away IMHO.
Re:WebAssembly Specification Prototype by fizzbatter on Wednesday July 13, 2016 @08:42PM (#12090932)
First off, sorry for the downvotes. Your opinion is unpopular, but it breeds discussion. Now..

I'm so lost, why on earth are you reading binaries? You keep citing examples of cleaning up after other people for a job. Why don't you have their source code?

If your job was with any other language, you would have the source code - you would not be given a Go binary and told to "fix what those previous morons did" - you would demand the source.

Are you saying that you are frequently given minified javascript off of some website and that the previous workers left with the source code?

Re:WebAssembly Specification Prototype by dccoolgai on Wednesday July 13, 2016 @10:11PM (#12091246)
First, no worries. If I have karma, there is no better way to spend it than advocating for a more maintainable Open Web in my opinion.

As for "I'm so lost, why on earth are you reading binaries?"

Consider every Perl/Haskell`/Smalltalk/COBOL developer for a moment. Do you think it's more likely that when this becomes a production standard they are going to say to themselves "You know what, I feel bad for the guys that will have to maintain this I'm just going to learn JS so at least it can be maintained in the same language the rest of the web is"... because I think it's probably more likely that they will immediately start transpiling binaries from COBOL etc, into WASM to run the web. Great for them, really but that's what leaves us with binaries to deal with.

Re:WebAssembly Specification Prototype by cstrahan on Thursday July 14, 2016 @01:10PM (#12095563)
It would be an incredible feat of engineering to be able to "transpile" an existing executable to WASM - if you're familiar with dynamic linking, the ELF format itself (or Windows' PE), the common processor instruction sets, etc - you'll know that won't be a problem anytime soon. Short of an x86 VM written in JS, it just ain't gonna happen.

Now, about having other languages compiled to the web, we already have that. Looking at specifically Haskell, we have GHCJS, and it (thankfully) works pretty well.

You may not like the idea that there will be new web projects using technologies that you lack proficiency in, but this is no different then how the rest of the software world works. For example, Google's Go language is picking up steam - in fact, I use it at work. If I didn't take the time to learn Go, I simply wouldn't be employed to work on that project. Similarly, I know people who are enjoying an incredible competitive advantage in their market by using Haskell for their web development (both backend with GHC and front end with GHCJS). If you don't learn Haskell, you won't be hired for those jobs. I do, however, guarantee that they'll still have the source on hand.

Re:WebAssembly Specification Prototype by justinpombrio on Wednesday July 13, 2016 @10:57PM (#12091378)
Would you mind answering the second half of that question? I'm curious.

> You keep citing examples of cleaning up after other people for a job. Why don't you have their source code?

Re:WebAssembly Specification Prototype by dccoolgai on Wednesday July 13, 2016 @11:18PM (#12091434)
Sure, let's have a karma bonfire: Sometimes I inherit minified code from someone who was hired years ago and for one of msny reasons is not available any more. It doesn't happen every day, thankfully. When it does, I'm happy that I can at least read and repurpose the JS that's left. Downvote away.
Re:WebAssembly Specification Prototype by onion2k on Thursday July 14, 2016 @01:20AM (#12091810)
If that's the case then you (or your clients, or whoever owns the code) have some rather serious code management issues. The answer is to fix that problem, not to suggest the programming language is broken because the compiled result isn't readable.

If you were working in C/Java/etc I'm sure your first reaction to the same problem wouldn't be "C is broken because I can't debug a compiled executable easily!".

Re:WebAssembly Specification Prototype by dccoolgai on Thursday July 14, 2016 @07:40AM (#12092961)
You seem to be suggesting that if I only had the source, that would solve all of my problems but that is one of my biggest fears about WASM to be honest- because the source of the web has always been JS or something extremely close to it, like coffescript or Typescript. Now someone could start writing source for the web in COBOL. I hope I'm wrong about this, and -50 karma from this thread is telling me most people think I am, but I genuinely fear a less maintainable Web.
Re:WebAssembly Specification Prototype by onion2k on Thursday July 14, 2016 @10:14AM (#12093940)
I don't think that's a valid complaint given the number of languages that can already be compiled to JS. Including COBOL ... https://github.com/ajlopez/CobolScript

It's a long list: https://github.com/jashkenas/coffeescript/wiki/list-of-langu...

Also, ultimately, there will be code that you can't maintain because you don't understand it. That might be because it's written in a language you don't know, but it might also be because it's written in a style you don't understand, or with a framework you've never used, or because it's about a topic that you haven't spent time with. That's OK. You don't need to be able to do everything.

Re:WebAssembly Specification Prototype by dccoolgai on Thursday July 14, 2016 @12:55PM (#12095439)
I see what you're saying and I know a lot of the fear I have is somewhat irrationally based on the idea that my knowledge of JS should give me the ability to fix anything on the web - and you rightly point out that there already are a bunch of languages that compile to down to JS/EmScripten/asm - so what's the big deal? I guess for me, it's just the fact that they at least have to knock on JS's door on the way to the web - so, in a sense, as a JS dev you get the privilege of at least being there between COBOL and the web. I recognize that's a position of privilege and it always hurts when privilege gets taken away - it may be more in keeping with the spirit of the Web that COBOL devs should have just as much access to the platform - and an equal-access compile target - as I do. I know asm/emscripten are a "thing", but they seem like a foot in the door for the buffet of languages that want access to the web, where ASM is blowing it wide open. I'm going to cherish the time I have left with JS as the lingua franca of the web and just accept that the future of the web will be one that I can't read/fix quite as well because it's not possible to know every language and I need to be OK with that... and I think I am for the most part, I'll just miss the Web of One Language.

Also - thanks for taking the time to make a thoughtful reply instead of just suggesting I'm a complete ignoramus and downblasting my response because we have a marginal disagreement about the Open Web Platform - made my day!

Re:WebAssembly Specification Prototype by fizzbatter on Thursday July 14, 2016 @01:20PM (#12095649)
It will definitely be interesting though, i will give you that.

Right now, if you are a frontend "web developer", you can pretty much assert what you know from the title alone. The title implies the toolset.

In ~5 years? It means.. what, HTML/CSS, and whatever language you prefer? Rust? C++? Python? JavaScript? An endless array of frameworks in a sea of different languages?

I mean, it's no different than most other development in that regard.. but the web certainly will go through a change when this day comes.

Re:WebAssembly Specification Prototype by Klathmon on Wednesday July 13, 2016 @05:52PM (#12089958)
Do a little reading about the wasm text format. It's not assembly, its meant to be read by JavaScript developers.