advancing javascript without breaking the web - munichjs

Post on 14-Jul-2015

22.260 Views

Category:

Education

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Advancing JavaScript without

breaking the web.

MunichJS, March 2015

Chris Heilmann (@codepo8) Munich, Bavaria (formerly Germany)

Generic solutions are easy to discredit.

New and more

advanced uses

of JavaScript

means we

need to

improve the

language.

Locking people out is

not an option.

The success of

JavaScript was and is

based on its

availability on the web

across browsers.

The problem is that

once something is on

the web, it is

impossible to remove

and we can’t force

everyone to stay up to

date.

'use strict';

strict mode is a way to opt in to a restricted variant of

JavaScript. Strict mode isn't just a subset: it

intentionally has different semantics from normal

code.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode/Transitioning_to_strict_mode

https://drive.google.com/file/d/0B2p58mpwToefRzlGMzRxTnhNb00/view

'use sanity';

'use the force';

A version that allows for smooth and exciting 60fps

animations by moving things magically around.

Canvas only.

'use paper and material provided';

A version for Polymer

'use emity';

An Apple specific version with libraries to create

glitchy graphical effects and a connection testing

feature that randomly disconnects WiFi

'use to excite VCs';

A specialist version dedicated to IOT and VR

'use this, bro!';

A version that makes omitting semicolons mandatory,

automatically moves opening braces to the next line

and commas to the start of the next line. Limited for

use in the Silicon Valley only (geofenced)

Seriously, now…

When it comes to

new functionality, we

can always use

progressive

enhancement.

https://justmarkup.com/log/2015/02/26/cut-the-mustard-revisited/

Opt-in with a string or

capability testing

doesn’t work when

syntax is changed.

Which is a shame, as

some of the new

things in ES6 are really

handy!

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/template_strings

http://kangax.github.io/compat-table/es6/

ES6 support in the wild…

Most ES6

improvements help

huge projects, by

allowing for familiar

OO syntax, memory

optimisation and JS

becoming a compile

target.

http://typescriptlang.org/

By changing the

language in a drastic

fashion we are losing

some of the interop of

JavaScript in the

browser.

Transpiling is one way

to work around that –

and we see this with

CSS and HTML, too.

Another solution

would be to go back

to the world of script

types.

Maybe that’s

something worth

considering?

In any case, working

with JavaScript never

gets boring.

So, go and take part

in the discussions

happening now!

Thanks!

Chris Heilmann

@codepo8

http://christianheilmann.com

top related