Earlier quoted context omitted.
JavaScript is further from an ideal language than many out there.
It isn't, because there is no ideal language. Seriously. Even if there was the goalposts would keep moving anyway as things like functional programming get more popular. My ideal language is one that I can use as often as possible in as many different contexts as possible. JavaScript is alright for that.
JavaScript at 20
141–150 of 327 posts
Re: JavaScript at 20
#142Edit2: When do you switch off your transpiler and serve native ES6? In 2020? Original: What do you do in 2017? What if you already code in ES6 and transpile it to JS5 at the moment. Do you simply switch from serving JS5 to JS6? Older browsers (todays current browser) don't support "class", "let" and other new syntax constructs. The just fail with JS errors. Can one browse the web with IE11 and iOS 8 Safari in 2017? (…
Re: JavaScript at 20
#143Can someone explain the isNaN part of this slide: http://brendaneich.github.io/ModernWeb.tw-2015/#46 I would expect isNaN("LOL") to be true. Why does he put "true?!", and why does Number.isNaN("LOL") evaluate to false?
Adding a new, proper isNaN function under a new namespace (Number) lets them do that without breaking the old functionality.
Re: JavaScript at 20
#144Can someone explain the isNaN part of this slide: http://brendaneich.github.io/ModernWeb.tw-2015/#46 I would expect isNaN("LOL") to be true. Why does he put "true?!", and why does Number.isNaN("LOL") evaluate to false?
I think I can. The old isNaN() coerces to Number, and non-numeric strings become NaN in JS, e.g. +"LOL" is NaN. However, the new isNaN() just returns false if the value passed isn't of the type Number, which I guess might be useful if you're going to use isNaN() on non-Number values? Before someone says that NaN means "not a number", technically yes it does, but it is really just a special value of the Number type. E…
Re: JavaScript at 20
#145Earlier quoted context omitted.
Chrome was trying to do this: https://developer.chrome.com/native-client However, cries of foul "vendor lockin" erupted. So I dunno what to tell you, man.
...no they weren't? They let you embed native code (platform-specific) or LLVM IR (vendor-specific) into a webpage. I don't see what that has to do with support for other languages. Anything NaCl can do, asm.js can do too, but one of these has multiple implementations, is backwards-compatible, is truly cross-platform, is well-specified, and is standardised. (Hint: it's not the first one.)
Re: JavaScript at 20
#146Earlier quoted context omitted.
Chrome was trying to do this: https://developer.chrome.com/native-client However, cries of foul "vendor lockin" erupted. So I dunno what to tell you, man.
...no they weren't? They let you embed native code (platform-specific) or LLVM IR (vendor-specific) into a webpage. I don't see what that has to do with support for other languages. Anything NaCl can do, asm.js can do too, but one of these has multiple implementations, is backwards-compatible, is truly cross-platform, is well-specified, and is standardised. (Hint: it's not the first one.)
> asm.js doesn't support threading.
asm.js supports threading, actually, through Web Workers and SharedArrayBuffer.
> it can't run native code.
This is true, but asm.js is relatively close to the metal. It's not very far from assembly language.
> it doesn't support meaningful debugging.
This is a tooling issue. While the situation is bad at the moment, it'll surely improve.
> it doesn't have a post-DOM API surface like pepper.
Why do you need a "post-DOM API surface"? If you just want to blit stuff to the screen, the DOM is actually no less efficient than Pepper: you can directly pass it pixel buffers, or call OpenGL routines.
Re: JavaScript at 20
#147Earlier quoted context omitted.
...no they weren't? They let you embed native code (platform-specific) or LLVM IR (vendor-specific) into a webpage. I don't see what that has to do with support for other languages. Anything NaCl can do, asm.js can do too, but one of these has multiple implementations, is backwards-compatible, is truly cross-platform, is well-specified, and is standardised. (Hint: it's not the first one.)
I think you're right that they weren't trying to do this with NaCl. They really were trying to do this with Dart, though.
Some were excited Dart might lead to some sort of bytecode VM being added, but that didn't lead anywhere. And since then, JS has become more bytecode-like, so it doesn't really matter now anyway.
Re: JavaScript at 20
#148Earlier quoted context omitted.
As I understand it, yes, 'var' is now obsolete. 'let' does the same thing with less confusing semantics.
So, 20+ years ago, javascript was a scheme(-like langauge) -- but was disguised as java for marketing -- now we can go back to a more scheme-like javascript? I wonder if we'd be better off with a proper scheme in the browser in the first place...
Re: JavaScript at 20
#149Edit2: When do you switch off your transpiler and serve native ES6? In 2020? Original: What do you do in 2017? What if you already code in ES6 and transpile it to JS5 at the moment. Do you simply switch from serving JS5 to JS6? Older browsers (todays current browser) don't support "class", "let" and other new syntax constructs. The just fail with JS errors. Can one browse the web with IE11 and iOS 8 Safari in 2017? (…
You can transpile from ES2015/16 (ES6/7) to ES5 code today. Babel[0] (formerly 6to5) is one such tool that will do just that. [0] https://babeljs.io/
Today we can use native JS5 and use polyfill for JS1-3 browser. In future (e.g. 2017) one will have to rely on a transpiler or stay with JS5 for many years - right?
Re: JavaScript at 20
#150Edit2: When do you switch off your transpiler and serve native ES6? In 2020? Original: What do you do in 2017? What if you already code in ES6 and transpile it to JS5 at the moment. Do you simply switch from serving JS5 to JS6? Older browsers (todays current browser) don't support "class", "let" and other new syntax constructs. The just fail with JS errors. Can one browse the web with IE11 and iOS 8 Safari in 2017? (…
Backwards compatibility on the web has long been backwards compatibility of source. Sites written in the IE6 era and not touched since should continue to work in browsers of today (which is why things like vendor-prefixed features proved to be a poor idea and are mostly no longer created). You'll get some rendering oddities, but this is still very much true.