Slashdot Mirror


WebAssembly and the Future of JavaScript

Nerval's Lobster writes: WebAssembly is the next stage in the evolution of client-side scripting. In theory, it will improve on JavaScript's speed. That's not to say that JavaScript is a slowpoke: Incremental speed improvements have included the rollout of asm.js (an optimized subset) in 2013. But WebAssembly—while not a replacement for JavaScript—is intended as a "cure" for a variety of issues where JavaScript isn't always a perfect fit, including video editing, encryption, peer-to-peer, and more. (Here's a full list of the Web applications that WebAssembly could maybe improve.) If WebAssembly is not there to replace JavaScript but to complement it, the key to the integration rests with the DOM and Garbage Collected Objects such as JavaScript strings, functions (as callable closures), Typed Arrays and Typed objects. The bigger question is, will WebAssembly actually become something big, or is it ultimately doomed to suffer the fate of other hyped JavaScript-related platforms such as Dart (a Google-only venture), which attracted buzz ahead of a Minimum Viable Product release, only to quickly fade away afterward?

175 comments

  1. WebAssembly by Anonymous Coward · · Score: 2, Insightful

    Never heard of it. Probably a passing fade. I predict decades more of Javascript and (alas) Flash.

    1. Re:WebAssembly by ArcadeMan · · Score: 2

      Decades more of Flash, eh? Is that the same Flash that I haven't used in over three years now?

    2. Re:WebAssembly by narcc · · Score: 4, Insightful

      Here's something you might not know: Your personal use case is not representative of the world at large.

      Flash is still quite popular, and isn't likely to vanish any time soon. Millions upon millions of users engage with flash content on the web daily. It's going to take a very long time for alternatives to catch-up in terms of authoring tools and, most importantly, content. It'll take even longer for that old content to fade into obscurity -- just like Java applets before it.

      I know it's cool to play the ideologue, but it's foolish to deny the obvious reality. Flash is going to be with us for many years.

    3. Re:WebAssembly by j127 · · Score: 1

      Flash doesn't run on iOS, so it's already on the way out. I block Flash on most websites, and rarely need to enable it. Flash will be around for many years but it's already on a major decline.

    4. Re:WebAssembly by Anonymous Coward · · Score: 2, Informative

      iOS actually sees relatively little use. Yes, selling a comparatively small number of rather expensive phones and tablets does give Apple some impressive revenue numbers, but the proportion of iOS users is very small. There are many more users using cheaper Android devices from a wide variety of manufacturers.

      Look at these recent browser usage stats, for example. iOS Safari is only about 7%. The old Android browser is still at over 5%, plus there's Chrome for Android at over 13%, and UC Browser for Android is over 5%, and even the failed Firefox for Android is at 0.14%.

      All of the mobile usage together still pales in comparison to desktop browser usage, even many years after mobile devices were alleged to have "killed" desktop and notebook markets. The number of people using Chrome 43 on non-mobile systems almost exceeds the total number of mobile users, across all platforms!

    5. Re:WebAssembly by omfgnosis · · Score: 0

      iOS actually sees relatively little use.

      False. It sees disproportionately high use. In terms of the web (where Flash matters), iOS use is much larger than its market share when compared to the market leader, Android. The distortion ends there, as the next runner up isn't worth mentioning in terms of usage share.

      Fact is, iOS is influential beyond its units shipped. Challenge it with a more influential offering, or accept it.

    6. Re:WebAssembly by narcc · · Score: 3, Informative

      Flash doesn't run on iOS, so it's already on the way out.

      So said everyone ... 7 years ago. At this point, it's just pure delusion. iOS just isn't relevant.

      The "major decline" you and everyone else has been on about nearly a decade just hasn't happened. Flash has declined, sure, but not significantly. Google and Mozilla recognize this, and have taken steps to ensure flash content will work in their browsers for the foreseeable future. After all, if their browser can't render the content people want, they'll look elsewhere.

      I suspect we'll have this exact same discussion 5 years from now. There's just too much content and the alternatives just aren't mature enough to see any significant change over the next few years.

      This is simply reality.

    7. Re:WebAssembly by Coolhand2120 · · Score: 0

      You know, flash will no longer work in Chrome. I think that makes it dead.

    8. Re:WebAssembly by Anonymous Coward · · Score: 0

      The "major decline" you and everyone else has been on about nearly a decade just hasn't happened.

      The decline of Flash is proceeding at a steady pace. You can't argue with the trend. It has happened.

    9. Re:WebAssembly by TheRaven64 · · Score: 3, Informative

      Why would you have heard of it? I've heard of it as a compiler writer, because the WebAssembly back end is currently being merged into LLVM, which will make it possible for all languages that LLVM can target to emit WebAssembly. It's basically the successor to PNaCl (heard of that?), but this time with cross-industry backing. Backers include Google, Microsoft, Mozilla, and Apple - that gives it a pretty good chance of appearing in all of the major browsers.

      --
      I am TheRaven on Soylent News
    10. Re:WebAssembly by Demonoid-Penguin · · Score: 1

      [...]Flash is going to be with us for many years.

      Like herpes. Except that HTML5 can, and does cure it.

    11. Re:WebAssembly by Dog-Cow · · Score: 2

      You know, you're ignorant. You have no will to be informed. I think that makes it so you should be dead.

    12. Re:WebAssembly by K.+S.+Kyosuke · · Score: 1

      The "major decline" you and everyone else has been on about nearly a decade just hasn't happened. Flash has declined, sure, but not significantly. Google and Mozilla recognize this, and have taken steps to ensure flash content will work in their browsers for the foreseeable future. After all, if their browser can't render the content people want, they'll look elsewhere.

      One would think that they could just eventually turn it into an HTML5 library...

      --
      Ezekiel 23:20
    13. Re:WebAssembly by K.+S.+Kyosuke · · Score: 1

      How well does WebAssembly compare to PNaCl? I was thinking or trying to do a "MetaOberon" (Oberon+OMeta) compiler, and am in search of a reasonable backend.

      --
      Ezekiel 23:20
    14. Re:WebAssembly by robi5 · · Score: 0

      Get some help, man.

    15. Re:WebAssembly by robi5 · · Score: 1

      There were a few mentions of (P)NaCl in this interview: https://medium.com/javascript-...

      tl;dr Brendan Eich suggests (P)NaCl becomes irrelevant over time (or it has already) and WebAssembly is the future.

    16. Re:WebAssembly by Anonymous Coward · · Score: 0

      I'm having a hard time following the argument here. He says that iOS is relatively (compared to other operating systems) seeing little use. You are stating that it is disproportionately high use. Does that mean that even fewer numbers of devices are over-reporting that 5%?

      It seems so, because you make an ad-hoc redefinition of "use" by stating that iOS use is larger than it's market share. I guess you are talking about how often a person "uses" their individual cell phone? If so, I doubt your non-referenced source data, as my iPhone wielding colleagues don't seem to use their phones more than others, and their iPads are mostly idle (the "pad" fad is mostly over, the only heavy tablet users these days seem to be those addicted to their kindles or nooks).

      As for the distortion that over-reports iOS usage (as your comments seem to imply), it is funny that you mention it doesn't exist for other devices.

      In short, an attempt at critically understanding what you have said seems to confirm the person you are calling out as having a "False" representation of the world, and if we take your arguments and his method of measurement and combine them, your own statements show that his numbers are too high!

      As far as 'influence", that's nice but not a directly measurable item. The iRiver (pre-iPod player) had an incredible amount of influence, but it didn't ship many units. That didn't make it have a conceptual larger share of the market, it just made it a really cool first attempt at a media player. The analogy doesn't fully hold to the iPhone or iPad, because those were not "first device" items, and those items sold incredibly well; but, the iRiver is a good example of how influence (measured in whatever way) is not connected to market share.

    17. Re:WebAssembly by Anonymous Coward · · Score: 1

      iOS actually sees relatively little use.

      False. It sees disproportionately high use. In terms of the web (where Flash matters), iOS use is much larger than its market share when compared to the market leader, Android. The distortion ends there, as the next runner up isn't worth mentioning in terms of usage share.

      Fact is, iOS is influential beyond its units shipped. Challenge it with a more influential offering, or accept it.

      If you're going to tell someone they're wrong, at least back them up with some numbers. Especially when the post you're replying to did include usage stats from one of the most reliable sources.

      What I'm seeing is actually that mobile in general is still a niche field when it comes to the web. There are certain things that people do with their phones on the web a *lot*, but the majority of day-to-day browsing is still done on the desktop (or more likely laptop).

      The other thing that it's important to be aware of is geography. The North American market has a strongly disporotionate number of iOS users compared with the rest of the world. If you live in some parts of the US, you'd think that everyone uses iPhones. It's not true. Across large swathes of Europe, it's Android that is overwhelmingly dominant.

    18. Re:WebAssembly by coofercat · · Score: 1

      indeed. All that's really happened is that Apple fans have missed out on Flash's 'killer app': http://www.misternicehands.com...

    19. Re:WebAssembly by KGIII · · Score: 1

      3% is not much. Let us look at a different, less drastic, graph from your own site:

      http://w3techs.com/technologie...

      --
      "So long and thanks for all the fish."
    20. Re:WebAssembly by Anonymous Coward · · Score: 0

      >It's going to take a very long time for alternatives to catch-up in terms of authoring tools and, most importantly, content.

      You know what could help with that? Adobe releasing Flash that compiles to SVG+JS. In fact, I think they already started with that...

    21. Re:WebAssembly by Anonymous Coward · · Score: 1

      False. It sees disproportionately high use. In terms of the web (where Flash matters), iOS use is much larger than its market share when compared to the market leader, Android.

      False. The grandparent posted the statistic results showing iOS has lower marketshare than Android.

    22. Re:WebAssembly by Anonymous Coward · · Score: 0

      iOS users are where the whales are, which is half of why everything launches with iOS first. The other half of that reason is that Apple heavily favors iOS timed exclusives, and heavily disfavors Android timed exclusives, which they can get away with because iOS is that lucrative of a platform.

    23. Re:WebAssembly by Wraithlyn · · Score: 1

      Mobile browser statistics suggest otherwise, but OK let's join you in fantasy land where "iOS just isn't relevant" to the web.

      How about Adobe? Is Adobe relevant to Flash? Because it was Adobe who pulled the plug on Flash mobile in 2011. Flash on mobile is a bloated battery-draining joke. Apple merely recognized that fact first.

      And if you're suggesting that mobile web is less relevant than desktop web, you've gone full retard.

      The decline HAS happened, and is still happening (are you saying a decline from ~14% to ~11% in a single year is "insignificant"??). Flash was everywhere 8 years ago. People built fucking site navigation out of Flash, if not entire websites. Those days are long gone, Flash is relegated to specific niche cases now, and continues to dwindle. The mobile-ization of web access (on all platforms) is absolutely the death knell of Flash, albeit one with a very long tail.

      --
      "Mind, as manifested by the capacity to make choices, is to some extent present in every electron." -Freeman Dyson
    24. Re:WebAssembly by Anonymous Coward · · Score: 0

      Truth is troll now? Stupid Android fanboys.

    25. Re:WebAssembly by TheRaven64 · · Score: 1

      It's very similar. WebAssembly is less closely tied to LLVM in its IR (which is a good thing, as LLVM IR changes over time quite significantly and maintaining compatibility with something that's almost LLVM IR is quite hard). Many of the people who worked on WebAssembly also worked on PNaCl, so have had the opportunity to learn from their mistakes and not have to worry about backwards compatibility.

      --
      I am TheRaven on Soylent News
  2. Webassembly means... by __aaclcg7560 · · Score: 4, Funny

    I can learn assembly language! On the web, no less!

    1. Re:Webassembly means... by Anonymous Coward · · Score: 1

      Real programmers use WebMachineCode.

    2. Re:Webassembly means... by markus · · Score: 3, Interesting

      You can write asm.js by hand, no so sure about WebAssembly, although there could be rare corner cases where this is warranted.

      But in almost all cases this is not the expected deployment scenario. Rather, you'll write your web app in one of many different high-level languages, and it will get compiled to WebAssembly. Interestingly enough, one of these languages is C++, which has a vastly different thread and memory model compared to JavaScript. This has always been a big stumbling block as there is existing C++ code that people would like to run in browsers, but up to now there was no good solution that works across browsers.

      The roadmap suggests that JavaScript will retain its robust memory and thread model, but gain enough features to support the less robust but higher-performant model used by C++. We truly live in interesting times.

      This will also address the problem that JavaScript could never effectively take advantage of multiple cores, but CPUs tend to add more performance by adding cores rather than by improving single-thread throughput.

    3. Re:Webassembly means... by smittyoneeach · · Score: 1

      Real programmers use webbinary: wwwmmwmwmwmwmwmwmwmwwmwmwmwmw

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    4. Re: Webassembly means... by Anonymous Coward · · Score: 0

      Cool! Assembler* was my second language, right after basic. Z80 programming was great fun!

      *well technically machine code: I didn't have no steenkin' assembler, just a book on z80 microprocessors, poke and usr commands in basic, and a memory map (to find unused areas). Now git off my lawn.

    5. Re:Webassembly means... by PPH · · Score: 4, Funny

      There's a book out already.

      --
      Have gnu, will travel.
    6. Re: Webassembly means... by fwarren · · Score: 1

      6502 assembly language rocked.

      Accumulator
      X register
      Y register
      Program Counter
      6 status flags packed in 1 byte

      Yielding 5 registers you had to track plus the Stack Pointer. With a total of 56 mnemonics/operands. It was a joy to program since you could remember what all the registers were doing in your head. On the other hand, with only one accumulator /general purpose register available, you did a LOT of gymnastics to get things done.

      Example adding $18 to a number at memory location $1020


      CLC clear the carry
      LDA #$18 Get the number $18 the low byte of $0018
      ADC $1020 add the low byte of the result to the accumulator
      STA $1020 store in the low byte of the result
      LDA #$00 get the number $00 the high byte of $0018
      ADC $1021 add to it the high byte of the second, plus carry
      STA $1021 store in the high byte of the result

      No real cool instruction like ADD #$0018, $1020 you had to do it all. Conceptually it was easy to keep track of it all.

      --
      vi + /etc over regedit any day of the week.
    7. Re: Webassembly means... by markus · · Score: 2

      6502 is a very restrictive architecture. This wasn't too bad, when problems were usually trivial enough that 8 bit operations or at best 16 bit operations were needed the bulk of the time. But for any non-trivial problem these days, that's just not the case. And the limitation of a single general purpose register, a 256 byte zero page, a 256 byte stack and almost no addressing modes is just way too restrictive, if you want to start writing your programs in a high-level language; if you write tiny trivial hand-optimized assembly programs, that might not be obvious.

      On top of that, the tiny address space made it impossible to write anything but the most trivial applications (by today's standards).

      For simple programs written during that time period, the code was reasonably dense, but certainly not ground breakingly so. If you tried to write any modern programs, you'd be wasting a lot of space emulating 32 bit (or wider) operations, switching memory banks, and figuring out how to work around the lack of an FPU; let alone a MMU. The code would be horribly verbose.

      x86 is actually not horribly bad by modern standards. It is almost the most compact encoding that anybody has managed to come up with, and that's a good thing. These days, memory bandwidth is a serious bottle neck and as a first approximation, the more compactly the compiler can encode your program, the faster it'll run. Code density is one of the driving forcing in going from asm.js to WebAssembly. asm.js is intrinsically verbose, but relies on compression to fix this issue.

      On the other hand, WebAssembly will have its own dense binary encoding. The encoding is probably not going to look very similar to traditional instruction sets, but instead mimic the internal representations used by compilers and JIT based virtual machines (such as modern JavaScript implementations). It is expected to be very dense, so that even bit web applications load quickly. But as far as I can tell, the binary format hasn't been finalized yet; in fact, I don't think there are any detailed proposals yet. Although that might have changed since I checked a few weeks ago.

    8. Re:Webassembly means... by cb88 · · Score: 4, Insightful

      Javascript doesn't have robust anything....

    9. Re:Webassembly means... by Anonymous Coward · · Score: 1

      Those look like WebButterflies to me.

    10. Re: Webassembly means... by Anonymous Coward · · Score: 0

      It's got a robust community of developers, a robust set of target platforms and a robust marketplace for employment. What more does it need?

    11. Re: Webassembly means... by Anonymous Coward · · Score: 0

      Z80 programming was great fun!

      As someone who actively codes Z80 assembly I am sad to inform you that you remember incorrectly.
      The Z80 was and still is a horrible mess. Its popularity came from being relatively cheap for an 8-bit CPU at that time. This cost effectiveness came partly from using a 4-bit ALU and pushing the data through it twice, that is why even single register to register operations take a minimum of 4 cycles + memory refresh.
      As a side effect even operations that doesn't use the ALU like simple load or nop also takes a minimum of 4 cycles.

    12. Re: Webassembly means... by Anonymous Coward · · Score: 0

      Oh it may well have been a mess, but my learning it coincided with my transition from having relatively little understanding of computers to really getting into the guts of the beast (microbee 32k in my case). So you might say that I'm a little extremely biased.

      Additionally there is an underlying structure to the opcode set, if not a great one. I know: I once wrote an emulator for the thing (picomozzy if you're curious). Emulated the z80 in x86 assembly just for fun. Which it was, but eventually I just ran out of spare time.

    13. Re:Webassembly means... by K.+S.+Kyosuke · · Score: 1

      You know, I really don't recall the last time a JS program jumped back at me with a memory bug.

      --
      Ezekiel 23:20
    14. Re: Webassembly means... by K.+S.+Kyosuke · · Score: 1

      x86 is actually not horribly bad by modern standards. It is almost the most compact encoding that anybody has managed to come up with, and that's a good thing.

      I had a crazy thought the other day that given a rich-enough set of benchmark program inputs and a modified compiler, perhaps an improved instruction encoding could be generated automatically, hand-in-hand with a compact (power-efficient) instruction decoder. On one hand, it seems like a really massive undertaking. On the other hand, shaving off bits of power consumption from future billions of devices all over the world over years of their operation could perhaps be worth it.

      --
      Ezekiel 23:20
    15. Re:Webassembly means... by robi5 · · Score: 1

      It has robust performance for a scripting language, running circles around Python, R (not including NumPy / BLAS / ATLAS), Ruby etc. dynamic languages; faster than most JVM based (non-Java) language implementations, and - for example, from my profiling on number crunching tasks - around as fast as Java.

      Also, there are not a lot of recent reports that start with: 'Due to a vulnerability found in JavaScript, millions of credit card details were exposed'

    16. Re:Webassembly means... by AmiMoJo · · Score: 1

      You can write WebAssembly by hand, in the same way you can write Java bytecode by hand. You probably wouldn't want to though.

      Although C++ is supported, not all of it is. The environment is heavily sandboxed too. Porting existing C++ will need some work, it's not just a recompile, although I think you realize that.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    17. Re:Webassembly means... by Anonymous Coward · · Score: 0

      This will also address the problem that JavaScript could never effectively take advantage of multiple cores, but CPUs tend to add more performance by adding cores rather than by improving single-thread throughput.

      it couldn't? https://github.com/austinksmith/WebHamsters

    18. Re: Webassembly means... by wues · · Score: 1

      Z80 programming was great fun!

      As someone who actively codes Z80 assembly I am sad to inform you that you remember incorrectly.

      "I hate what I am doing, so it cannot be fun to anyone". You are very wrong. Programming Z80 was a great fun. And it had nothing to do with how the number of cycles per operation.

    19. Re: Webassembly means... by cb88 · · Score: 2

      Javascript targets two platforms in practice... x86 variants, and Arm variants. Anything other than that and you are out of luck be it PCC, Sparc, SH, 68k, AVR, PCI whatever.... At least with webassembly there is hope that anything LLVM can target webassembly will be able to target with minimal effort.

    20. Re:Webassembly means... by cb88 · · Score: 1

      http://betanews.com/2015/03/24/amazon-patches-huge-xss-vulnerability-that-left-user-data-exposed-for-two-days/

      They do exist though...

    21. Re:Webassembly means... by null+etc. · · Score: 1

      You can write WebAssembly by hand, in the same way you can write Java bytecode by hand.

      Not exactly. WebAssembly uses an Abstract Syntax Tree, which, while available in text and binary format, is quite a bit different than just listing out a sequential series of bytecode instructions.

      https://github.com/WebAssembly/design/blob/master/AstSemantics.md

    22. Re: Webassembly means... by DamnOregonian · · Score: 1

      I concur emphatically.
      My first forays into machine code (manually constructed with a book and poked) was on a Z80... And it really was an amazingly fun experience.
      These days, dealing with assembly in modern ARM and MIPS processors, while so much more capable, and having features that make writing assembly ridiculously powerful, I do miss the utter simplicity of that Z80- so simple a kid was able to pick it up.
      It really was great fun.

  3. I don't think it will gain much traction by msobkow · · Score: 4, Insightful

    One of the big "security benefits" I've heard claimed is that WebAssembly will only be able to invoke the same functions/methods as JavaScript itself. So that implies that WebAssembly is nothing more than pre-compiled JavaScript.

    As the compile phase of JavaScript pales in comparison to the execution phase, the only people I can see pushing for this are those who want DRM-style protection of their JavaScript so no one else can read it.

    --
    I do not fail; I succeed at finding out what does not work.
    1. Re:I don't think it will gain much traction by markus · · Score: 3, Informative

      An awful lot of work has gone into making JavaScript virtual machines both high-performance and super secure. This is a difficult thing to get right. It is good to see that this work can now be leveraged for other languages, rather than forcing browser manufacturers to redo the work for each and every language. In the process they'd inevitably get something wrong, and that's quite dangerous; insecure browsers mean compromised computers.

    2. Re:I don't think it will gain much traction by Anonymous Coward · · Score: 0

      WebAssembly may be less wasteful of CPU/memory resources by minimizing garbage collection?

    3. Re:I don't think it will gain much traction by phantomfive · · Score: 2

      Javascript has features that make it difficult to optimize and compile (like the ability to create new functions from code at runtime, or the fact that every variable is an associative array).
      WebAssembly is a reduced-functionality version of Javascript that allows better optimization. That is the purpose.

      --
      "First they came for the slanderers and i said nothing."
    4. Re: I don't think it will gain much traction by Anonymous Coward · · Score: 1

      WebAssembly (WASM) is, at least initially, just a ASM.js with better compression (binary). You can even convert losslessly between ASM.js and WASM. And do remember that ASM.js is just a subset of JavaScript that removes slow features, so you can convert all the way back to plain JavaScript from WASM. ASM
      Js proved that JavaScript subsets could be almost as fast as native, and that killed any justification for Googles Native client (Nacl/pnacl) which if popularized would have added 8mb of undefined behavior to every browser. WASM is (effectively) a JavaScript subset that has no DRM features, and so even if it's used for DRM-related pure math the Function call would be easily faked to break DRM. WASM is no friend of DRM. The only reason for WASM over ASM.js is that text for ASM.js is big (even with http gzip) and slow to parse. That's it. Now, with all that said, WASM could have features added to it for your dire DRM scenario, and we should oppose that.

    5. Re:I don't think it will gain much traction by Anonymous Coward · · Score: 0

      this. everyone likes to use the Single Page Application model, but your competitors can download your entire program and de-minify it. The only stuff you can hide is the backend service code.

    6. Re:I don't think it will gain much traction by Anonymous Coward · · Score: 0

      It's just as easy to obfuscate your Javascript so that it's as difficult to parse as WebAssembly theoretically would be. In fact they are already planning "decompiling" tools, presumably coupled together with the likes of source maps, so that it would be possible to debug your code with the original lines of code available, so I doubt it would be any worse than JS in this regard. It certainly isn't adding anything resembling actual DRM (that's the EME spec for video, and the plugin APIs).

      In addition, the compile phase is the bottleneck these days for just about everything. In fact, most code doesn't even get compiled, it's just interpreted, except the "hot" code that runs in loops and the like. This will allow all the code to be ahead-of-time compiled, which will improve performance across the board. Plus it will remove a lot of the guesswork that the VM has to do to just-in-time compile, which includes a lot of backtracking to cancel out optimizations that prove to be problematic. JS engines are already quick enough that this might not all seem that important, but given that browser themselves are written largely in JS these days, it will actually make a big difference.

    7. Re:I don't think it will gain much traction by markus · · Score: 4, Informative

      That is possibly true, although details will still need to be seen. asm.js programs typically allocate a single static memory region that they than manage themselves without bothering the JavaScript VM to track memory references. In fact, a asm.js program doesn't have access to garbage collected objects. As soon as it tries to access those, it falls back to JavaScript mode (every asm.js program is by definition also a valid JavaScript program, but not necessarily vice versa).

      WebAssembly programs at least originally will do the same as asm.js. It is possible that as more experienced is gained with this feature, there will be a way for WebAssembly to tap into the garbage collected pool of objects. Only time will tell.

    8. Re:I don't think it will gain much traction by Anonymous Coward · · Score: 0

      > So that implies that WebAssembly is nothing more than pre-compiled JavaScript.
      It's less than pre-compiled JavaScript. It's pre-compiled asm.js-style JavaScript. That's the whole point.

      The idea isn't to make compilation faster, it's to make execution faster due to not having to consider code paths which cannot actually be taken. Because all of the values involved are statically typed, compiling a function which is meant to operate on integers doesn't have to consider the case where a value is a string, float, object, array, function, null or undefined.

    9. Re:I don't think it will gain much traction by Anonymous Coward · · Score: 0

      WebAssembly is a byte code and virtual machine model (as opposed to implementation), and is almost as unrelated to JavaScript as x86 ISA byte code.

      In the beginning, the ability for WebAssembly to call JS code will be quite limited. See https://github.com/WebAssembly/design/blob/master/FutureFeatures.md#gcdom-integration

      However, JS code calling into WebAssembly will be much easier as long as your WebAssembly routines return simple values like strings, numbers, or typed arrays.

    10. Re:I don't think it will gain much traction by Daniel+Hoffmann · · Score: 2

      V8 actually has two JIT compillation modes exactly because of things like this. One handles "easy" functions and the other handles "hard" functions (functions that contain eval or try and catch for example), the "easy" compiller has worse performance. This link explains it well:

      https://github.com/petkaantono...

      Great read for people who want to optimize for V8, many of the tips should be valid for other javascript engines as well.

      From the article:

      Currently not optimizable (ie will use the slower compilation method):
      Generator functions
      Functions that contain a for-of statement
      Functions that contain a try-catch statement
      Functions that contain a try-finally statement
      Functions that contain a compound let assignment
      Functions that contain a compound const assignment
      Functions that contain object literals that contain __proto__ , or get or set declarations.

      Likely never optimizable:
      Functions that contain a debugger statement
      Functions that call literally eval()
      Functions that contain a with statement

    11. Re:I don't think it will gain much traction by j127 · · Score: 1

      I don't like the idea of precompiled JavaScript, because it will be harder to block trackers and advertising.

    12. Re:I don't think it will gain much traction by thisisauniqueid · · Score: 1

      It's more than just pre-compiled Javascript. It has proper types (like integers! In 2015!), unlike Javascript. It will be an easier compilation target than asm.js for both traditionally compiled languages (C/C++) and newer languages. There will be freedom to break from Javascript conventions that have held back the Web, such as the single-threaded nature of the Javascript VM (of course there are Web Workers, but no proper shared memory model currently etc. -- this slows down multithreaded code, requires a different programming model, and is not a good foundation for the future of multithreaded apps). Really WebAssembly is what NaCl and pNaCl were trying to be.

    13. Re:I don't think it will gain much traction by geggo98 · · Score: 1

      One of the big "security benefits" I've heard claimed is that WebAssembly will only be able to invoke the same functions/methods as JavaScript itself. So that implies that WebAssembly is nothing more than pre-compiled JavaScript.

      This "API level" protection is the same kind of protection that Java Applets have with their "Security Manager": Some module has to decide if that API call is allowed or not. While it is possible to get that concept right, Java already failed here. The ope question is: How can JavaScript succeed with the same concept, where Java failed before?

    14. Re:I don't think it will gain much traction by robi5 · · Score: 1

      Yes, it's interesting how often the newly introduced ES6 etc. elements are slower than what they replace, even though the ES6 version is typically saner and more conducive to optimization. For example, Maps are probably still slower than the current string based objects. But we don't have to go that far. A couple of years ago there were bug reports about the performance of typed arrays. The very point of typed arrays is that they can be made faster (and of course WebGL support through number type representation). But by that time, probably enough time went into optimizing untyped arrays that implementations probably already stored homogenous arrays (e.g. numbers only) as typed arrays internally, while the JavaScript typed array implementations were newer, less used and probably less heavily optimized.

      So you could speed up number crunching by switching from a typed array to an untyped array!

    15. Re:I don't think it will gain much traction by Anonymous Coward · · Score: 0

      One of the big "security benefits" I've heard claimed is that WebAssembly will only be able to invoke the same functions/methods as JavaScript itself. So that implies that WebAssembly is nothing more than pre-compiled JavaScript.

      As the compile phase of JavaScript pales in comparison to the execution phase, the only people I can see pushing for this are those who want DRM-style protection of their JavaScript so no one else can read it.

      I can't say I'm won over by it yet either -- the main purpose for it's existence is performance, but the kind of perf gains it will offer will only be of any relevance to a tiny fraction of developers. Sure, if you're writing FPS shooters in the browser, then you're going to want this. But for the rest of us, this isn't going to deal with most of the real performance bottlenecks that exist in real-world sites.

    16. Re:I don't think it will gain much traction by KGIII · · Score: 1

      Can't JavaScript be obfuscated? I seem to recall this as true. I have not done any JavaScript authoring ever, really. I have torn into other bits and hacked my way into getting what I needed it but I know absolutely no JavaScript at all and just adjusted others to suit my needs because, well, once you can write code you can generally pick stuff up easier.

      --
      "So long and thanks for all the fish."
    17. Re:I don't think it will gain much traction by Anonymous Coward · · Score: 0

      An awful lot of work has gone into making JavaScript virtual machines both high-performance and super secure. This is a difficult thing to get right. It is good to see that this work can now be leveraged

      hold it rightthere, lets' get the secure done first, cause we aint there yet by a long shot, javascript is still a major attack vector

    18. Re:I don't think it will gain much traction by Daniel+Hoffmann · · Score: 1

      Yeah it is because the optimizing compiler does not know how to optimize those things yet. But in reality having a proper examinable bytecode would be better for those times you actually need every little bit of performance. Examining the bytecode of your own code is easier than trying to understand the compiler (badly documented and forever evolving) optimizations.

    19. Re:I don't think it will gain much traction by robi5 · · Score: 1

      Since it's JavaScript, you probably meant assembly?

    20. Re:I don't think it will gain much traction by Daniel+Hoffmann · · Score: 1

      WebAssembly is a bytecode, from my understanding not much different than Java.

    21. Re: I don't think it will gain much traction by Anonymous Coward · · Score: 0

      I thought something like an AST.

    22. Re:I don't think it will gain much traction by Anonymous Coward · · Score: 0

      If the code or assets used by the advert are being retrieved from a 3rd party server on the list of known servers used to serve advertising then it will be just as easily blocked as it is today.

  4. TypeScript by innerpeace · · Score: 2

    Google and MS are teaming up on this and it will be in AngularJS 2. With that kind of weight behind it, I'd bank on it being the next JS replacement/supplement.

    1. Re: TypeScript by Anonymous Coward · · Score: 0

      It already is. Most of typescript is now implemented in ES6. This was one of the goals when it was first created.

    2. Re:TypeScript by omfgnosis · · Score: 1

      LOL Angular 2.

  5. WebAssembly (and asm.js) solved the boot strapping by markus · · Score: 4, Informative

    Previous attempts at replacing JavaScript always suffered from a boot strapping problem. While there are only a small number of major desktop browsers, overall, there are actually a lot of different minor browsers that people expect to work. And even among the desktop browsers, not everybody always runs the most recent release.

    Content producers don't really like writing content that only 30% of their users can view. So, unless a new technology is rolled out to 90+% of the deployed browsers, nobody is going to write content for it. On the other hand, if nobody writes content, the rest of the browser manufacturers won't put any resources into adding support for the new technology.

    Both asm.js and WebAssembly have a fallback mode that uses plain JavaScript, as available in virtually 100% of all browsers. Performance will obviously be degraded, but that's much better than making the content completely inaccessible. And users are more likely to upgrade their browsers, if they can see a low-fidelity version of the content and know by switching to a newer browser they'll get the high-fidelity version. So, unlike the previous scenario, this is actually a virtuous circle.

  6. Different languages by wrmrxxx · · Score: 5, Insightful

    JavaScript execution speed is not the important thing about WebAssembly. What does matter is that it may open up the development of software for execution inside a browser to a wider variety of languages, almost all of which are likely to be better than JavaScript in one way or another.

    1. Re:Different languages by markus · · Score: 3, Insightful

      JavaScript isn't necessarily such a bad language; otherwise, we wouldn't see Node.js gaining so much popularity.

      But you are of course right, that there isn't a one-size-fits-all language, and there are plenty of problems that can better be solved in other languages. Allowing more choice of languages for web apps is a good thing.

      Also, some of the more advanced JavaScript features that are in the pipeline (or starting to be deployed) are really cumbersome to program manually. All the work that will allow implementing pthreads in JavaScript is really low-level. It'll be nice to have compilers that target these features.

    2. Re:Different languages by Anonymous Coward · · Score: 0

      I perfectly agree with you. For some reasons some people think that on the WEB there should only be that crap that javascript is. Of course they do not want any other language in the middle of the way or it will show how much crappy their preferred language is.

      Traditionally in computing we always had a whole lot of languages that evolved over time... it should be the same thing on the WEB and if WebAssembly can do the trick, well, i for one welcome it.

    3. Re:Different languages by Anonymous Coward · · Score: 0

      Sweet, now I can write both server and client-side code in PHP, these are exciting times

    4. Re:Different languages by weilawei · · Score: 3, Insightful

      JavaScript isn't necessarily such a bad language; otherwise, we wouldn't see Node.js gaining so much popularity.

      Bandwagon appeal. With your UID, you ought to know better. Provide a technical argument and/or step away from the keyboard until you've thought it over. Note that I'm not saying there isn't a good reason--only that your given argument is crap.

    5. Re:Different languages by St.Creed · · Score: 1

      I'm not so sure that JS is crap. I started learning Javascript a few months ago and I'm actually much more impressed by the language than I thought I'd be. It has a lot of functional programming features that I like, it's easy to write and quite forgiving. There are some weird things I'd rather not have seen (like variable hoisting, although I understand why it's there), but in the main I've seen worse languages.

      --
      Therefore, by the (faulty) logic you're using, you're just a cow with a keyboard - osu-neko (2604)
    6. Re:Different languages by Anonymous Coward · · Score: 0

      Well, you are certainly entitled to your own opinion and taste. To me JS is crap.

      I have programmed since when i was 10, back in the 80es; i have learned pretty much anything computer related i could find, but javascript is not my thing.

      Unfortunately, since there is no real alternative, i MUST use it, and every time i do it makes me hate every single minute i have to waste on it.
      Dart would be a MUCH better alternative, but it would be much better if it could run natively on all the browsers (which it doesn't because Mozilla, Apple and Microsoft wanted to sabotage it without any good reason) so i am stuck with a language that, quite honestly, is the worst thing i found in computer science in the last 30 years of my life.

      The point here is that you can still like Javascript, even if i'll never understand how the hell "like" and "javascript" can exist in the same sentence, but i should have the option to use a different language which should be a first class citizen in any browser out there exactly as it happens in the world outside the WWW. The times when only BASIC was readily available on pretty much any computer is long gone... it seems that in the WEB we are still there and there are people actively fighting to keep it this way.

    7. Re:Different languages by markus · · Score: 1

      JavaScript has a couple of really ugly warts (I'm surprised you mentioned variable hoisting, but left type coercion out), but fortunately with a little bit of discipline most of these issues can be avoided quite easily.

      It is extremely flexible, and you can implement a large variety of programming paradigms with it. Unfortunately, it lacks some of the syntactic sugar to make this easy. So, short to medium size programs usually work great. Larger programs get cumbersome at some point.

      Fortunately, there are all sorts of pre-processor style languages that can help with this. And browsers have source maps these days, so that's even reasonably seamless.

      As far as embeddable language, JavaScript is overall not a bad design. Not surprisingly, it made a lot of the same trade-offs that other embeddable languages (e.g. Lisp or LUA) did. It is deceptively simple, but sufficiently different that it is really easy to falls into the trap of not learning it properly and trying to write JavaScript as if it was C++ (or Java, or ...). I suspects that's the main reason why people don't like it.

      On the positive side, it made a couple of decisions that paid off really well. First and foremost its decision to only ever have a single thread of execution really stands out. This makes it much easier to write a secure virtual machine, and that's really the most important question when embedding a language in a web browser; of course, the single thread of execution also is the one thing that gets into the way when taking existing non-JavaScript code and trying to execute it in a JavaScript VM. WebAssembly is an attempt to bridge this gap.

    8. Re:Different languages by Anonymous Coward · · Score: 0

      I don't "like" "javascript" ?

    9. Re:Different languages by Anonymous Coward · · Score: 0

      JavaScript isn't necessarily such a bad language; otherwise, we wouldn't see Node.js gaining so much popularity.

      For Node.js I suspect it's more groupthink than any explicit benefit that Node.js offers. I've seen deployments where the rationale for using Node.js was "because some guy told me it was good." Most people don't have good reasons for the stack they use.

    10. Re:Different languages by maestroX · · Score: 1

      Provide a technical argument

      object notation, lambda, c syntax.
      Read JavaScript: The Good Parts by Douglas Crockford.
      Actually pretty impressive for javascript to become leading web scripting language.

    11. Re:Different languages by KGIII · · Score: 1

      I do not know much about JavaScript. I have mostly hacked other people's work to fit my needs. However, the worst? Hmm... Have you never tried QBasic?

      --
      "So long and thanks for all the fish."
    12. Re:Different languages by MobyDisk · · Score: 1

      I think weilawei really meant to say: "Provide a technical argument for why Node.js is gaining so much popularity." I am not sure if your post does that.

      The features you listed are in pretty much every other major language. The book you referenced is a somewhat tongue-in-cheek look at how to use the good parts of a bad language. The conclusion I reach from those points is "yeah, it's bad, but see how people took the good parts and made it useful." Which doesn't really support the argument for why it is gaining popularity on the server-side.

    13. Re:Different languages by sproketboy · · Score: 1

      > Actually pretty impressive for javascript to become leading web scripting language.

      WTF? It's the only game in town. What language did you expect to become successful? Any other language requires a plug-in which makes it not universal - so therefore we all just stick with what's going to run across all the browsers - even though it's a shitty language.

  7. yeah definitely a passing fade by Anonymous Coward · · Score: 0

    you know, like a shadow!

    1. Re:yeah definitely a passing fade by Anonymous Coward · · Score: 0

      I couldn't correct it after posting but I decided I like the image even better anyway!

  8. Depends on the libraries by Anonymous Coward · · Score: 0

    Need to be more useful than jQuery, AngularJS, etc.

    1. Re:Depends on the libraries by Anonymous Coward · · Score: 0

      Yep, if it can't beat what everyone is using then why bother?

    2. Re:Depends on the libraries by narcc · · Score: 1

      That shouldn't be terribly difficult.

  9. Exclusive native apps still exist by tepples · · Score: 1

    Content producers don't really like writing content that only 30% of their users can view.

    Developers of exclusive apps for Mac, iOS, and video game consoles have historically not had much of a problem with limiting their market. They think they can get a better overall return on investment from targeting OS X only compared to OS X and Windows, or iOS only compared to iOS, Android, and Windows Phone, or one console compared to all consoles plus Windows PC.

    1. Re:Exclusive native apps still exist by markus · · Score: 1

      A application that only sells in the Apple store is very different from a web site that can only be viewed with an iPhone.

    2. Re:Exclusive native apps still exist by tepples · · Score: 1

      Trying to avoid DWAD:

      A application that only sells in the Apple store is very different from a web site that can only be viewed with an iPhone.

      In what way, other than that one is wrapped in a UIWebView and one isn't? I'm curious as to your reasoning.

    3. Re:Exclusive native apps still exist by Fwipp · · Score: 1

      There's no expectation that an Apple Store app is going to work on Android, or a windows laptop, or a PS3. When I look for Android apps, I check an android app store - I know that the vast majority of what I find will work on my device.

      But everyone who visits a website expects that website to render and work for them - there's no segregation between "the apple web" and "the microsoft web" when you're at your computer, it's all just one big pile of sites. Users are aware that sometimes there are browser-specific issues, of course, but trying to load a site that is incompatible with your browser is *much* more frustrating than being unaware of an app that exists for another platform.

    4. Re:Exclusive native apps still exist by AuMatar · · Score: 1

      Non-iphone users would try to use your website and be unable to. This will make your software look crappy, which will cause bad reviews and diminished PR. Look at games- you can develop for just PS4, and that's fine because a PC user isn't going to even try to use it. Release an unusable PC port like the latest Batman game, and you get complaints, bad reviews, and lost sales because everyone's heard how crappy the game is.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    5. Re:Exclusive native apps still exist by tepples · · Score: 1

      Non-iphone users would try to use your website and be unable to.

      I already get that, with sites such as Instagram and Vine requiring download of a phone app just to set up a commenting account.

    6. Re:Exclusive native apps still exist by Anonymous Coward · · Score: 0

      In what way, other than that one is wrapped in a UIWebView and one isn't? I'm curious as to your reasoning.

      One way is that the web version adds tens/hundreds of milliseconds to every call that the application wouldn't have, simply by virtue of the TCP/IP requests it has to make.

    7. Re: Exclusive native apps still exist by Anonymous Coward · · Score: 0

      With service workers you can cache resources and avoid that overhead. Or you can just use JavaScript + local storage (IE8+)

    8. Re:Exclusive native apps still exist by savuporo · · Score: 1

      > Non-iphone users would try to use your website and be unable to. This will make your software look crappy.

      BS. You can traverse any number of urls in your favorite browser that are not supposed to open for you, ever, because they are API endpoints, behind authentication wall, or any other reason. Nobody prevents me from deploying a customized http://thenewestiphonesonlytha... and just plain redirecting anyone and everyone whose user agent looks even slightly off. And if you got there by changing your user agent or using something like Links browser and cant render it, then thats kind of your problem.

      --
      http://validator.w3.org/check?uri=http%3A%2F%2Fwww.slashdot.org Errors found while checking this document as HTML5!
  10. Emscripten by tepples · · Score: 2

    What does matter is that it may open up the development of software for execution inside a browser to a wider variety of languages

    That already existed: Emscripten compiles any language with an LLVM front-end, such as Clang++, to asm.js. Apparently one of the goals of WebAssembly is to make Emscripten more practical.

    1. Re:Emscripten by markus · · Score: 1

      Exactly. Think of asm.js as the proof-of-concept and WebAssembly as the production-ready solution.

      asm.js was a very valuable first step to get the browser vendors on board. But WebAssembly will push much further. Most importantly, it intends to support POSIX threads for languages such as C++. That's something that asm.js never knew how to address.

    2. Re:Emscripten by Anonymous Coward · · Score: 0

      Apparently one of the goals of WebAssembly is to make Emscripten more practical.

      But also to aim higher than Emscripten. From an interview with Brendan Eich on Medium: "At first, WebAssembly starts out just like ASM.js, but with a compressed syntax, that’s a binary syntax. But once all the browsers support both wasm and ASM.js, and after a decent interval of browser updates, then wasm can start to grow extra semantics that need not be put into JavaScript. They may in fact be put into both JavaScript and wasm because it’s the same one engine (1vm), but there are certain things we might not want to ever put into JavaScript that could be put into wasm for the benefit of other languages like C++ or Haskell. There are lots of languages you might compile to wasm."

    3. Re: Emscripten by binarylarry · · Score: 1

      I proclaim Larry's Law:

      Those who fail to understand Java will attempt to reinvent it. Poorly. And compile it to JavaScript.

      --
      Mod me down, my New Earth Global Warmingist friends!
    4. Re: Emscripten by Jeremi · · Score: 1

      Those who fail to understand Java will attempt to reinvent it. Poorly. And compile it to JavaScript.

      Given the current state of Java-inside-the-web-browser, I don't see how they could do any worse than Sun/Oracle did...

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    5. Re: Emscripten by KGIII · · Score: 1

      I have never really heard a GOOD reason for Java to be in the browser to being with. Ever... Enlighten me if you wish. I am truly curious - legitimate question.

      --
      "So long and thanks for all the fish."
    6. Re: Emscripten by binarylarry · · Score: 1

      Well you see, if you broke the rules and read the article, they're defining a new intermediate code format that's kind of like Java byte code (not really, but the intent is somewhat similar).

      This "WebAssembly" is an abstraction over real hardware, that is compiled just in time so it can be executed on the native hardware or converted to JavaScript and interpreted by a VM.

      Personally, I think it's cool but it's definitely reinventing a lot of concepts Java tried, succeeded at (cross platformness) and hilariously failed at (Java Applets).

      --
      Mod me down, my New Earth Global Warmingist friends!
    7. Re: Emscripten by Anonymous Coward · · Score: 0

      Good luck compiling C++ to Java bytecode.
      JVM is too high level for this to be efficient.

    8. Re: Emscripten by Anonymous Coward · · Score: 0

      I agree. There's plenty of room for distributed applications on the Internet, but using HTTP and the browser as the platform for them has been disastrous.

    9. Re: Emscripten by binarylarry · · Score: 1

      They can compile C++ to javascript for fucks sake, see emscripten.

      --
      Mod me down, my New Earth Global Warmingist friends!
    10. Re: Emscripten by Jeremi · · Score: 1

      I have never really heard a GOOD reason for Java to be in the browser to being with. Ever... Enlighten me if you wish. I am truly curious - legitimate question.

      Originally Java was intended to fill all of the custom-client-side-logic use cases that JavaScript (and to a steadily shrinking extent) Flash do now. But it didn't do a very good job of that, and instead found its calling on the server side.

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    11. Re: Emscripten by KGIII · · Score: 1

      That makes sense, thank you. My understanding is that Java was actually created to be used by cable companies for client-side interactive media (more specific than what you said) so that makes sense to me.

      --
      "So long and thanks for all the fish."
  11. A practical response: by krotscheck · · Score: 1

    We'll use it when it has 95% browser support. And no, polyfill doesn't count.

    --
    This signature can save you $400 on your car insurance!
  12. Where is my multithreading by Anonymous Coward · · Score: 0

    Hello, it's 2015, where's my MULTIFUCKINGTHREADING? I a fucking sick of seeing just one particular core die under JS duress while the others just sit there sucking their thumbs.

    1. Re:Where is my multithreading by DamnOregonian · · Score: 1

      Instead, I want *all* of my cores to be hung on some advertisements embedded javascript!

  13. People who don't want any JavaScript by tepples · · Score: 1

    For some reasons some people think that on the WEB there should only be that crap that javascript is.

    I think some of the problem is that some codgers think the World Wide Web is the wrong place for interactivity in the first place. They want to read static documents. And if they want to interact in any way, they prefer doing so through POSTing a <form>. Finally in cases where the form paradigm is not enough, they prefer native apps such as an SMTP/IMAP, NNTP, or IRC client. They don't want any JavaScript, much as the couple in that Monty Python sketch didn't want any SPAM luncheon meat.

    To those people I say: If someone releases a new native app for communication over the Internet, good luck installing a Windows .msi on your Mac or a Mac .dmg on your not-Mac. Or good luck recompiling any app for a major set-top box and running it, even if you have written your own 10 foot user interface.

    1. Re:People who don't want any JavaScript by Anonymous Coward · · Score: 0

      I think some of the problem is that some codgers think the World Wide Web is the wrong place for interactivity in the first place.

      Browsers are designed for presenting information and do a good job at it relative to everything else. They however consistently suck ass at emulating desktop applications.

      They want to read static documents. And if they

      Who cares if a document is static or not?

      want to interact in any way, they prefer doing so through POSTing a . Finally in cases where the form paradigm is not enough, they prefer native apps such as an SMTP/IMAP, NNTP, or IRC client

      Domain specific clients provide superior performance and user experience. They tend to be devoid of assorted annoying crap like commercials plastered all over the place, constant unwelcomed change and need to be constantly connected to perform operations that should otherwise not require network access.

      To those people I say: If someone releases a new native app for communication over the Internet, good luck installing a Windows .msi on your Mac or a Mac .dmg on your not-Mac.

      Shit you have a point. I never considered this before. Until now I always assumed people would chose to run the installer designed for their operating system.

      Or good luck recompiling any app for a major set-top box and running it, even if you have written your own 10 foot user interface.

      Good luck finding anyone who cares.

      I would care about a new programming platform for the web but so many have totally failed that it is better to just ignore the space and assume failure as a safe default position.

    2. Re:People who don't want any JavaScript by epyT-R · · Score: 1

      Yeah, but those applications that do target multiple platforms natively will offer superior experiences for users of those platforms while they all interact with one another. The last thing I want to depend on is yet another browser based turd that's here today, gone (or butchered) tomorrow.

  14. Web Workers by tepples · · Score: 2

    Hello, it's 2015, where's my MULTIFUCKINGTHREADING?

    What problems have you run into with Web Workers?

    1. Re:Web Workers by markus · · Score: 1

      WebWorkers allow multiple threads of execution, but they don't support a shared address space. For some applications this is acceptable. For others, not so much.

      And for any application that previously existed as a C++ application using pthreads, WebWorkers just don't work at all.

      WebAssembly is working on a solution to this problem. This is one of the most exciting features that WebAssembly promises.

    2. Re:Web Workers by guruevi · · Score: 1

      I think he meant native multithreading and sorry to say, it ain't coming. JS was designed to be a single threaded, event driven language. It will never be multithreaded as it would break events and that is a problem with all event based languages/programs. You're stuck with the speed of a single core, fine for general purpose processors where you just throw more power at the problem (110W/CPU for modern systems) but really bad on low frequency/power multicore systems.

      --
      Custom electronics and digital signage for your business: www.evcircuits.com
    3. Re:Web Workers by Anonymous Coward · · Score: 1

      For fuck's sake, tepples! Look at the goddamn page you just linked to! Look at the section about browser compatibility. Do you see all of those "Not supported" entries, especially for the mobile browsers? That's what's wrong with Web Workers. Just like most newer web technologies, and even some older ones, the lack of cross-browser support renders them useless!

    4. Re:Web Workers by robi5 · · Score: 1

      Isn't it true that when you need a lot of performance, in particular, on parallelizable tasks, then the workload in question is typically number crunching? If this is the case, then it is useful that web workers allow us to pass typed numeric arrays back and forth via reference. It is not a fully general solution to parallelism, but what are the use cases when it's insufficient?

  15. Oh look, another dice clickbait by tiagosousa · · Score: 5, Informative

    Might as well read an interview with the man behind webassembly. Found it extremely informative and I'm looking forward to a future where all major browsers support first-class alternatives to javascript through webassembly.

    1. Re: Oh look, another dice clickbait by Anonymous Coward · · Score: 0

      Yeah, ok, guy that's dating guy who created web assembly. Stop letting your romantic feelings cloud your judgement.

    2. Re: Oh look, another dice clickbait by Anonymous Coward · · Score: 0

      Yeah I'm sure Brendan "gay hater" Eich has a boyfriend

    3. Re:Oh look, another dice clickbait by Chelloveck · · Score: 1

      Ah, countering Dice clickbait with Medium clickbait. Well played!

      --
      Chelloveck
      I give up on debugging. From now on, SIGSEGV is a feature.
  16. Pre-ES6 browsers by tepples · · Score: 1

    But is ES6 polyfillable, or does it require serving transpiled pre-ES6 files to pre-ES6 browsers?

    1. Re: Pre-ES6 browsers by Anonymous Coward · · Score: 0

      It can be polyfilled with Babel.js.

  17. Rant: The Web is Bleeped Up - Redo! by Tablizer · · Score: 1, Interesting

    It's time to rework the web presentation and GUI (non) standards. There are too many layers in the current stack, and it relies on fat clients where large GUI libraries and GUI-related code have to be potentially downloaded for every site. It's very poor factoring of tools, libraries, and bandwidth. The bulk of GUI libraries should be part of the browser.

    I suggest we start over with 2 new standards: one for a practical work-oriented CRUD & down-to-business browser (or browser mode); and one "eye-candy" browser (or browser mode) for store-fronts, visually gimmicky pages, style fads, and games.

    New markup languages with common GUI idioms built in would be designed, reducing the amount of custom client-side code and client-side GUI's libraries needed or downloaded.

    The eye-candy standard would be allowed to change faster. If your toys crash, it matters less than if your bank forms crash. Think of it kind of like an open-source Flash competitor.

    There would be some overlap between the practical browser standard and the eye-candy standard where appropriate, but we don't want to hold one back to cater to the other.

    CRUD-oriented GUI idioms mostly settled by the late 1980's and don't need to be redone every 3 years. By separating eye-candy from practical UI standards, the practical side doesn't have to be bumped around by web/style fads, and the styly side doesn't have to worry about crashing real work.

    Call this new standards kit "The Mullet": Business in the front, party in the back. Well, actually it's the reverse for most sites: Party in the front (main page is the attention-getter) and business the back: the details once you subscribed and start doing your stuff. Thus, "Tellum", mullet in reverse.

    Forget the job security of the current arcane stack: let's feel the joy of being altruistic, and blow it up and do it right. Let's build Tellum! We'll put half us of out of work, but at least feel the joy of refactoring the web world. (Bots & H1B's will replace us all soon anyhow.)

    1. Re:Rant: The Web is Bleeped Up - Redo! by Anonymous Coward · · Score: 0

      "one for a practical work-oriented CRUD & down-to-business browser"

      I can see it now, TN3270.js :-)

    2. Re:Rant: The Web is Bleeped Up - Redo! by Anonymous Coward · · Score: 0

      Basically my thoughts as well. HTML, CSS and Javascript are fantastic at what they were designed for: presenting information with maybe a little visual flair.

      They are at best mediocre for trying to create applications (which is what we are desperately trying to do).

      There's a reason things like AngularJS are getting popular, they attempt to side step the idiocy of using the DOM as the basis for a dynamic UI. Flash and Silverlight were attempts (and solved many of the problems). Unfortunately they were proprietary attempts that ultimately failed because of logistics and the devil in the details, not the merit of their approach. Though they have at least got a ground swell of better thinking going (see: AngularJS which shares many of the same concepts as Flash/Flex/Silverlight)

    3. Re:Rant: The Web is Bleeped Up - Redo! by Shados · · Score: 0

      That can't work for a simple reason. Half of the people working on all these standards are downright retarded, and only failure in the real world gets them to realize it. Google's and Microsoft's representatives are the worse offenders, trying to stick their obsolete development practices in the browser, and failing over and over and over. (Hell, THIS is yet another attempt by them along with Mozilla)

      They'll be the first ones trying to manipulate any kind of new standard, and what you'll get will be a weird hybrid of Java Swing and Direct X or some shit. It will be a disaster.

      THAT is why web gui idioms keep having to be redone. They go on the right track, then the peanut gallery come in with big names behind them, and fuck it up. Then we have to start over. Over and over and over.

    4. Re:Rant: The Web is Bleeped Up - Redo! by phantomfive · · Score: 1

      The direction things are moving is this:
      * The browser provides basic building-blocks (for display, execution).
      * Vendors supply programmer-friendly frameworks on top.

      For example, HTML5 allows you to create custom tags, which frameworks like angular.js makes plentiful use of. In fact, some people who use Angular.js don't even know how to write plain old html/javascript. Sad but true.

      If WebAssembly succeeds, it will do the same thing to javascript. JS will be gone, and you can use whatever language you want that will compile down to WebAssembly.

      --
      "First they came for the slanderers and i said nothing."
    5. Re:Rant: The Web is Bleeped Up - Redo! by Anonymous Coward · · Score: 0

      We don't need any of that. Desktop frameworks are decades ahead of web frameworks. All we need is better security and fine grain permissions at the program level so you can safely download and run random applications from the web. This would solve so many end user and developer problems, but it'll never happen because then advertisers wouldn't be able to spy on everything you do.

      The web is slowly moving in this direction in the worse possible ways. New languages, new frameworks, new security models, and major efforts turning browsers into OSes instead of upgrading what already existed.

    6. Re:Rant: The Web is Bleeped Up - Redo! by Tablizer · · Score: 1

      Vendors supply programmer-friendly frameworks on top.

      Yes, but it usually becomes a revolving fan-boy circus with rapid generations and new frameworks-of-the-week. Plus, cross-browser/version compatibility is still tricky. If you have public-facing sites, you need to support old browsers.

      We need the equivalent of a GUI-Oriented Netscape to come along and shake things up. Being a "product" tends to lock things down for long enough for a standard to catch on. JS/Dom Frameworks are too malleable to establish a de-facto standard.

      If Flash weren't proprietary, it perhaps could have done something similar. Java applets tried it, but its API's were unnatural and too roundabout. What took 3 lines of code in VB classic took 40 in Java. Maybe the designers had future abstraction or flexibility in mind, but it failed to translate into here-and-now benefits. "Look, I'm using the reverse head-up-ass manager reflection lollypop visitor tourist pattern, just like the GOF!"

    7. Re:Rant: The Web is Bleeped Up - Redo! by Tablizer · · Score: 1

      But you'd need to have fairly different builds each for Apple, Linux, and Windows.

      All we need is better security

      Which may be tricky for OS's that have decades of cruft for backwards compatibility or archaic conventions that are too established.

    8. Re:Rant: The Web is Bleeped Up - Redo! by phantomfive · · Score: 1

      Yes, but it usually becomes a revolving fan-boy circus with rapid generations and new frameworks-of-the-week.

      That's how it is now. And it will only get worse for a long time into the future.

      Or better. I like having lots of frameworks, even if most of them (all of them?) are lousy.

      --
      "First they came for the slanderers and i said nothing."
    9. Re:Rant: The Web is Bleeped Up - Redo! by maz2331 · · Score: 1

      Hey now, don't laugh at that idea. Sites like Bloomberg could use that to interface their mainframes straight to trader's screens in a browser, and knock a fraction of a second off the update time...

    10. Re:Rant: The Web is Bleeped Up - Redo! by Anonymous Coward · · Score: 0

      I think you mean add... AS400 terminals were designed for low-latency in ways Web developers are just now rediscovering...

  18. Inner platform effect by Anonymous Coward · · Score: 0

    How did we get to the point where we so thoroughly depend on a SCRIPTING LANGUAGE that we have to resort to this crap?

    If you need this kind of speed, why aren't you writing native code?

    1. Re:Inner platform effect by Anonymous Coward · · Score: 0

      This is really a kind of attempt to define "native code" for the browser.

      You should realize by now that the Web is a platform?

  19. Re:WebAssembly (and asm.js) solved the boot strapp by Anonymous Coward · · Score: 0

    Both asm.js and WebAssembly have a fallback mode that uses plain JavaScript, as available in virtually 100% of all browsers.

    ASM.js and WebAssembly require the ArrayBuffer and other modern JS features. There's really no reason not to just keep JS and add a secondary more efficient bytecode language (like Java, etc.) and have it be lean, mean, browser-embedded language (unlike Java). I mean, think about that flash plugin crap, and how it got started even though we already had scripting.

    Graceful degradation smegradation, the truth is that the browser MFGs should have been pushing forward a standard bytecode whether anyone develops for it or not. The devs have to push out things like native 32 bit Integer array buffer objects or web workers before anyone can make use of them.

    ASM.js is crap right now, if you want to instantiate a secondary ASM.js function, you're SOL unless you turn that ASM.js code into a GIANT string and call the Function constructor with the code as an argument (rather than just adding "use asm" to the function). The foolish designers of ASM.js were only interested in features that Emscripten could use and so you can't bind a secondary heap or share a heap amongst multiple ASM.js compiled objects -- That makes using webworkers with ASM.js really shitty, as you have to either rebuild the ASM.js object to pass the array buffer between them, or copy the buffer into the ASM.js object from "external" JS code. As long as advancements are kept backwards compatible with such retarded designs then we'll wind up in the same boat as we have with JS (since that's what the problem is). Rather than just designing a new system from scratch (or dropping in the FLOSS Davlik VM that Android uses and calling it a day) we're going to limp forward towards some broken shit that'll eventually be binary bytecode and even harder to debug. Sure, it'll be more performant than JS, but WHAT ISN'T?!

    The whole "you have to have devs before you can push it out" is nonsense because no one was writing JS code before it was bolted onto HTML. The sunk cost fallacy is shite.

  20. "Minimum Viable Product" by Anonymous Coward · · Score: 0

    Javascript IS the Minimum Viable Product. If you cannot present all of the standard features people expect, you cannot be viable. Use jquery's documentation as a crib sheet. Ask yourself "how will I implement this in my thingamajigger?" If you're feeling frisky look at angularjs too. (protip: when you're done supporting the minimum jquery feature set, please remember that jquery is shit and does jack with text. We're going to expect you to deal with text too.)

    If you release a halfassed piece of shit that can't even do javascript navigation like github uses, nobody's going to do anything but point and laugh.

  21. A thought... by Anonymous Coward · · Score: 0

    If it's web then it ain't assembly. Shit bust.

  22. Light DOM. by Anonymous Coward · · Score: 0

    Here's a better idea, create a less impacting DOM, and/or rewrite the entire DOM system from scratch since it is a piece of shit that literally nobody in the history of ever likes.

    DOM is the absolute worst part of webdev and is also the thing that slows down the evolution of standards because every new feature needs to go through a shitastic amount of testing to be sure it doesn't break every single thing ever.

    Also, while you are at it, rewrite CSS too.
    You bet your ass you will be adding version control in. Versionless standards are absolute cancer to development.
    Lesser and older machines should be capable of being served or represented in a simpler way trivially using a very basic version system and nothing more, none of this JavaScript crap should be needed, no hacky CSS either.

    JavaScript is generally heading in the right direction. The next major version will be incompatible as well, bonus points to them for not letting the mistakes of old ruin EVERYTHING.

    And finally, someone remake "tables for layout" in CSS already. You had ONE JOB. ONE!
    Every "replacement" for it has been obtuse as high hell and back. NO. Go. Just go. Straight F. Don't even see me after class, go home and cry for your complete and utter failure of work.

    1. Re:Light DOM. by Anonymous Coward · · Score: 0

      What do you have against the Go language?

    2. Re:Light DOM. by savuporo · · Score: 1

      80ies are calling. They want their GOTOs and error handling paradigms back.

      --
      http://validator.w3.org/check?uri=http%3A%2F%2Fwww.slashdot.org Errors found while checking this document as HTML5!
  23. "Callable closure" - closure != anonymous function by __roo · · Score: 1

    Minor apologies for being a bit pedantic, but just in case anyone's confused by the possible misuse of the term "closure" in the summary...

    From the Wikipedia entry on closures:

    The term closure is often mistakenly used to mean anonymous function. This is probably because many programmers learn about both concepts at the same time, in the form of small helper functions that are anonymous closures. An anonymous function is a function literal without a name, while a closure is an instance of a function, a value, whose non-local variables have been bound either to values or to storage locations (depending on the language; see the lexical environment section below).

  24. Summary of use cases by Anonymous Coward · · Score: 1
    > Better execution for languages and toolkits that are currently cross-compiled to the Web (C/C++, GWT, ).

    Why? Widgets are the one thing that Javascript does right? And I doubt you will see a difference in performance as its sync access to the framebuffer that usually slows down 2D graphics drawing on modern hardware.

    > Image / video editing.

    Why would I do this in a web app? And the issue with doing this in a web app has to do with taking better advantage of the UI interaction model (using touch, multi-button mice, etc well) which WebAssembly doesn't nothing for.

    > Games:

    X3D and WebGL do this just fine but I guess it could help. Probably the strongest use case for this tech.

    > Peer-to-peer applications (games, collaborative editing, decentralized and centralized).

    No, just no. This is an invitation to a security nightmare.

    > Music applications (streaming, caching).

    Its not broken now.

    > Image recognition.

    Sure, why not.

    > Live video augmentation (e.g. putting hats on people's heads).

    Seriously?

    > VR and augmented reality (very low latency).

    Will have custom hardware and software to support it and I seriously doubt the VR folks will consider JS for their language. They mostly use C++ for good reasons.

    > CAD applications.

    Same as Image Editing above.

    > Scientific visualization and simulation.

    Not broken now although some serious cool stuff with WebGL and X3D is coming.

    > Interactive educational software, and news articles.

    ??? No idea, guess they were running out by this point.

    > Platform simulation / emulation (ARC, DOSBox, QEMU, MAME, ).

    Just no...

    > Language interpreters and virtual machines.

    A VM on a VM?

    > POSIX user-space environment, allowing porting of existing POSIX applications.

    So access to the filesystem. That can't possibly go wrong.

    > Developer tooling (editors, compilers, debuggers, ).

    WebMonkey is already pretty good and you can have my xemacs when you pry it from my cold dead hands. The idea of a web code editor is almost insulting.

    > Remote desktop.

    No, HTTP is a terrible protocol for this and a native app works way better.

    > VPN.

    No, too many serious security issues here

    > Encryption.

    Built into the browser already.

    > Local web server.

    Why? And more security issues...

    > Common NPAPI users, within the web's security model and APIs.

    Ok, finally a good idea. But it causes the browser to be a central point of failure for the security model.

    > Fat client for enterprise applications (e.g. databases).

    Bad, bad, bad idea. App servers and web servers exist for a reason. That reason is that DBs typically don't handle large numbers of connections well so app server allow users to share connections and thus reducing load on the DB. Not knowing the reasons for something are not the same as something being useless.

  25. When an installer for your OS doesn't exist by tepples · · Score: 1

    Until now I always assumed people would chose to run the installer designed for their operating system.

    That's fine if an installer designed for your operating system exists. So let me rephrase: If someone releases a new native app for communication over the Internet, good luck installing a Windows .msi on your Mac because there's no .dmg or a Mac .dmg on your not-Mac because there's no .msi or .deb or .rpm. Or is every developer expected to provide 14 different installers for each application, one for each of 14 operating systems?

    1. Re:When an installer for your OS doesn't exist by Anonymous Coward · · Score: 0

      what you think getting the app working on all of the constantly changing set of hundreds of browsers, all with different addons, security settings, cache settings, etc. will be any easier in the long run?

    2. Re:When an installer for your OS doesn't exist by tepples · · Score: 1

      what you think getting the app working on all of the constantly changing set of hundreds of browsers, all with different addons, security settings, cache settings, etc. will be any easier in the long run?

      Depends on how long the "long run" is. Several of the 14 platforms I have in mind have application deployment costs that far exceed the cost of a domain, hosting, and (if needing EV or if launching prior to the Let's Encrypt rollout) a TLS certificate. Many require all code to have been signed with a digital certificate from the platform's monopoly CA, which costs $100 per platform per year. Some even require each developer to be an established company, not an individual, and to undergo assessment of relevant experience and the company's financial stability before the platform's curator will even give the developer access to the SDK, plus thousands of dollars to re-certify and push each update to a published application. (See Fez.)

      Besides, even with those differences, the JavaScript APIs for Firefox resembles those for IE and Safari a lot more than, say, Cocoa resembles Win32.

  26. A project looking for use cases, desperately by Anonymous Coward · · Score: 0

    No one seems to know what Webassembly should be good for. Let it die, it burns human brain cycles for nothing.

  27. Re:"Callable closure" - closure != anonymous funct by Anonymous Coward · · Score: 0

    the confusion arises from the fact that languages with real closures generally support anonymous functions
    trivially

    and languages which only support some sort of restricted function-as-value syntax with limited call semantics
    go out of their way to call these things lambdas

  28. Obligatory link: The Birth & Death of JavaScri by dottrap · · Score: 1

    Gary Bernhardt was ahead of the curve with his extremely amusing talk The Birth & Death of JavaScript.
    https://www.destroyallsoftware...

    A look back from the year 2035, he talks about the importance of having a assembly language for the web (asm.js) and tongue and cheek allowed the world to move past JavaScript where it finally becomes both a dead language and also what everything is built on.

  29. It's called silverlight, and it flopped by Anonymous Coward · · Score: 0

    Not again some binary mumbo jumbo you cannot look into without specialized tools.

    Not again some special apis that are only available in browser xyz.

    Not again something that may have the capability to create draconian drm.

  30. Doesn't address the real problem by jandersen · · Score: 0

    The real problem with Javascript is that it is code that gets pushed to your browser from an essentially unknown source. It doesn't matter if it is fast or not, it gets pushed at you in a situation where you are not in a position to make a good decision about what this software is and whether you want it or not. My own, somewhat awkward solution is to use NoScript and not allow any Javascript as a default. Most sites work OK without, and for those that don't, I have the control I need to make a decision about things.

    Javascript can be a brilliant tool and if used correctly, can make a web application run like a desktop application; but I have been around far too many obscenely abusive Javascripts to allow it unlimited access to my system. It isn't a lot of fun, when you have to go to a console to kill off your browser because some idiot has served you a looping Javascript.

    1. Re:Doesn't address the real problem by Anonymous Coward · · Score: 0

      try umatrix instead of noscript, umatrix works much superiorly for that task

  31. Reminds me of Coffeescript by Anonymous Coward · · Score: 0

    which was a form of Ruby-like language that would be converted to javascript automatically.

    As always, it's the rubbish languages that are well supported so they end up being popular, e.g. JavaScript and PHP

  32. Easy answer: by Qbertino · · Score: 2

    Find a feasible FOSS replacement for Flash that enables fast and easy cross-plattform development for performant non-trivial 'good-looking' client applications - and you have a winner. Offer some tacky half-assed JS cross-compiler nonsense, and your new tech won't get off the ground. The Web and DOM tech is a mess enough as it is, without yet another PL/runtime solution thrown into the mix.

    However, I remain slightly optimistic that this may be the long awaited not-fucked-up-by-adobe FOSS Flash successor we've been waiting for. All other non-foss contenders failed throughout the last 15 years, but this might have a chance, also since there is nothing else around and the web has taken over as platform of choice due to 80ies style tech fragmentation via the mobile revolution.

    Two cents from a senior webdev.

    --
    We suffer more in our imagination than in reality. - Seneca
  33. Re:"Callable closure" - closure != anonymous funct by robi5 · · Score: 1

    Why would an anonymous function need to be a function literal? What if it's the result of a compose, or some other higher level function?

  34. Use Cases by Chelloveck · · Score: 1

    To summarize the linked page...

    Intended Use Cases:

    • Programming

    Really, the only type of programming not listed there is hard real-time. Way to narrow your focus, guys.

    --
    Chelloveck
    I give up on debugging. From now on, SIGSEGV is a feature.
  35. Re:"Callable closure" - closure != anonymous funct by __roo · · Score: 1

    Technically, the anonymous function is just the literal in code, and it's only "anonymous" because the programmer didn't give it a name—the compiler will sometimes assign it a generated name, but it will sometimes do something else (eg. reuse code from elsewhere in the program, roll the function into the caller, etc.). It becomes a closure when that function is combined with a scope.

    So higher level function would return a closure value, which would be the function bound to the values in scope. Those aren't the same thing as anonymous functions. For example, they could all be reusing the same anonymous function—that function might be compiled into one location in the assembly or bytecode (if it's .NET bytecode, for example, it might have a generated name like "b__0"), and then called from within scope.

    A composed function would generate another literal function valuelike if you have two functions F and G and compose them into lambda(i) => F(i) + G(i), then that lambda would return an anonymous function. But if you assign it to a variable and call it, then it's bound to a scope and becomes a closure.

    Make sense?

  36. Hard to imagine C coding in a web environment by clenhart · · Score: 1

    I don't give it much chance unfortunately. Even if I wanted to code in C (which I don't), I wouldn't be able to get it used in our development shop.

    However if they had a C# to WebAssembly compiler (that utilized the JS garbage collector), it would be much easier to start using this at work.

  37. Re:"Callable closure" - closure != anonymous funct by robi5 · · Score: 1

    Thank you for the explanation, as an FP user I didn't have an issue with the concept of anonymous function vs. closure, so let's forget about closures - e.g. assume that there is no variable capture and all functions are pure - and let's stick to the meaning of anonymous functions as defined by the cited wiki page.

    If I have functions f and g, and have a higher order function C, which, for example, composes two functions, then C(f, g) is a definitely a function. Also, it is a function that has no programmer assigned name.

    While I don't know if such a function is most properly named 'anonymous function' or just 'function', in my opinion it makes sense to not conflate two different concepts in a way the wikipedia article did.

    One of the concepts is how we _denote_ a function (e.g. through a literal directly in the source code, vs. via a series of function calls involving compose, currying etc. sprinkled around in the code base, which is pretty customary in FP).

    Another, orthogonal concept is whether capture is involved or not.

    There can be named functions which do capture, or which don't capture; and there can be unnamed (anonymous) functions which capture, or don't capture. So I think the cited wiki article poses a false dichotomy, possibly arising from the fact that in certain programming languages, functions have not traditionally been first-class objects, and aspects of FP filtered in gradually.

  38. Re:WebAssembly (and asm.js) solved the boot strapp by Anonymous Coward · · Score: 0

    >Sure, it'll be more performant than JS, but WHAT ISN'T?!

    Practically every other scripting language worth using. The following are generally NOT more performant than JS: Python, Ruby, Perl, Lua, etc. At least on Chrome's V8 runtime, I don't know about SpiderMonkey, JSC, or Chakra.

    We could compare WASM to compiled languages, but we also have to keep in mind the "W" means "Web" and therefore "sandboxed". So we pay a security penalty.

  39. Um, Java bytecode? by groblewis · · Score: 1

    Why do we need yet another "standard". I know Java gets a (mostly undeserved) bad rap from a lot of people, but plenty of other languages are compiling to the JVM.

  40. Re:"Callable closure" - closure != anonymous funct by __roo · · Score: 1

    You're definitely right about the Wikipedia article glossing over some of the specifics, but I'm not sure I agree that the dichotomy is false. (I'll have to dust off the cobwebs a bit—I first learned this stuff when I was studying CS at Carnegie Mellon way back in the early '90s. :)

    My understanding is that one important reason to separate the literal function from the closure (function + scope) has to do with separating syntax from semantics. You the function itself just gives you the symbol manipulation; you can't interpret the meaning of it until you have its context, in the form of a scope (or stack frame, etc.).

    Symbolic manipulation versus semantic meaning is really important when you're proving things like computability. I remember back in a graduate mathematical logic course, we used only formal logic to prove some complex fundamental theorem of calculus—but the meaning of that theorem was completely irrelevant, we did the proof entirely through symbol manipulation. So we were able to derive the proof syntactically, without any of the calculus semantics. Not sure if that helps illustrate the difference. Like I said, it's been a while since I studied this stuff. :)

    From a more practical perspective, this matters a lot when doing compiler optimization. When you use an anonymous function—where "anonymous" literally just means "doesn't have a name"—a typical compiler will do all sorts of optimizations. I see this a lot when doing .NET programming: if you have an anonymous method that has the same contents as a named method, the C# compiler will just call it, or if the anonymous method is only called once, it may just embed it directly into the calling method, etc. (You can actually see this yourself by writing some code, compiling it, and using ildasm to look at the byte code.) Capture is really important here: this won't work with a closure, because it has the scope. However, a lot of times something that looks like a closure doesn't actually require the scoped variables, or they can be passed in as references, so it can be compiled into an anonymous function.

    I've been doing a lot of Scala programming lately, and it's done a lot differently behind the scenes in Scala—and the delineation between anonymous and named is a lot more blurry from a compiler perspective. If you define a Scala function:

    object MyScalaObj { runAFunction(f: Int => Int) { println(f(3)) } }

    this looks a lot like it takes as its f parameter the kind of method that's compiled into a compiler-named anonymous method. But Scala is bytecode-compatible with Java, so this is actually done on the object level—you can pass it an instance of an object (in this case, an instance of scala.runtime.AbstractFunction1):

    static Function1 FunctionObj = new AbstractFunction1() {
          @Override
          public Object apply(Object i) {
                return (Integer)i + 6;
          }
    };

    and call it like this from Java:

    MyScalaObj.runAFunction(FunctionObj);

    So when the Scala compiler compiles an anonymous method, it generates an object like FunctionObj. The reason this is relevant is because what looks anonymous to Scala is actually not just a function with a stack context, but in fact an actual object on the heap. This is about as far from a literal function as you can get.

    And now you know why I thanked Bob Harper in the preface to my most recent book. :)