068 JSJ ES6 with Aaron Frost

Download MP3



01:36 - Aaron Frost Introduction


Book Club

JavaScript Allongé with Reginald Braithwaite!  He will join us for an episode to discuss the book on August 1st. The episode will air on August 9th.

Next Week

The Application Cache with Jake Archibald


JAMISON:  Are you guys going to do a doo-wop chorus? I feel like with you all sharing the same microphone, we need some sick vocal harmony. MERRICK:  I wouldn’t mind starting a JS Jabber a cappella group. [Hosting and bandwidth provided by the Blue Box Group. Check them out at Bluebox.net.]  [This episode is sponsored by Component One, makers of Wijmo. If you need stunning UI elements or awesome graphs and charts, then go to Wijmo.com and check them out.]  JAMISON**Hey everybody and welcome to JavaScript Jabber Episode 68. I am your guest host, Jamison Dance. Chuck is at LoneStar Ruby Conf this week. We have Merrick Christensen. MERRICK:  What’s up? JAMISON:  We have Joe Eames. JOE:  Hey there. JAMISON:  And we have an incredibly special guest, Aaron Frost. AARON:  Hello. MERRICK: **[Laughter] What?**JAMISON:  And he is not British. AARON:  Coming from across the pond. MERRICK:  Once you’re gone, I’m going to start using that as my greeting. AARON: **Well, I wish my name was like that one guy, the Allonge, Reginald Braithwaite. [Laughter]**AARON:  Where it’s like your name’s in British. JOE:  Yes. Your accent, no. Oh, I would have my name be Benedict Cumberbatch. AARON:  That’s pretty British too, that name. JOE:  That’s a very British name, yeah. AARON: **Wellington something. [Laughter]**JAMISON:  Then you would be the archduke of JavaScript. AARON:  Yeah. JOE:  Oh, that would be an awesome title. AARON :  That’d be great. It’s a good title. MERRICK:  So Jamison, do you want to talk about why we have Aaron on the show? JAMISON:  Yeah, I was going to ask him to introduce himself. AARON:  Oh, great. I’m a web developer at an awesome company called Domo. JOE:  But what’s your official title? AARON: **Officially, I don’t know. What are you playing at? [Laughter]**AARON:  Maybe an open web strategist. JOE:  There you go. JAMISON:  Social media expert? AARON:  I don’t know. But I work on our UI team and we’re getting ready to push out a really awesome release that everyone’s going to love. I’m also an author. I’ve published a short book with O’Reilly in May and working on another book. They’re both about the next version of JavaScript, ECMAScript 6. JAMISON:  That is what we are here to talk about today, right? We’re going to talk about ES6 and why we should be super excited. Do you want to just go over the terminology? Maybe some people don’t’ know what ECMAScript even means or what 6 is. 6 is a number. JOE:  Yeah. Not just that. Harmony, all the code names. JS.next. JAMISON:  TC39. Oh, man. Buzzwords. AARON:  Yeah. Someone should be writing these down, because we can talk about all of them. JAMISON:  Okay. AARON: **To start off, how are JavaScript and ECMAScript related? When Brendan first built JavaScript, to say effectively, it was called LiveScript. By the time it was in beta, Sun had gotten involved and they renamed it to JavaScript. They tried for a really long time to make progress and then they did make some progress and eventually had some falling outs. There are some videos online where you can watch Brendan and Eich talk about it -- Brendan and, sorry, Douglas Crawford. One of them compares it to the Fellowship of the Rings where they just fell apart and the other one compares it to The Good, The Bad, and The Ugly. They just kind of fell apart and [inaudible] so what happened in the past was they got this international standard body called ECMA to adopt the API of what was then JavaScript. And that API became the official script API of ECMA. So ECMAScript is like this API. Then there are different implementations of it. Implementations some of us have heard of, JavaScript is one, VBScript would be one, some companies have implemented their own flavor of something like JScript, which is like JavaScript, but it’s…**MERRICK:  ActionScript? AARON:  ActionScript, yup. And you guys probably know more. But these are all implementations of ECMAScript API. JavaScript is an implementation of ECMAScript. So when ECMAScript versionally gets update, when they update that API, all the implementations now got to go update and try and work together. So Microsoft’s implementation tries to get to play well with Firefox’s and Chrome. MERRICK:  Got it. JAMISON:  So, ECMAScript is the canonical one and the thing everyone calls JavaScript is really just the implementation of the standard, right? AARON:  Yeah. JAMISON:  Sweet. JOE:  It sounds like the adoption by a standards body, that was an almost, I don’t know if it was at the time that they realized how wise it was, but I assume that the adoption of JavaScript across the browsers had a lot to do with the fact that it was a real standard rather than just one body saying, “Hey, we’ve got this thing.” AARON:  Yeah. I listened to the talk with Brendan and it sounds like at first, ECMA didn’t get too involved. Even though it was officially adopted as their script language, they didn’t seem to participate a lot. He said later on, finally, they started. They got a solid group of people together that they could finally talk and start making agreements. When that happened, he said ECMA even started coming to the meetings, which he thought was significant. I think it took them a while to get really involved. But yeah, the more that the need to have browsers do the distributed computing arose, ECMA got more involved. JOE:  Do you know, who is ECMA? AARON:  I don’t know who ECMA is. JAMISON:  Are there shadowy conspiracy theories about ECMA? Are they part of the triumvirate that runs the world’s governments or something? MERRICK:  Boys who are smoking cigars and running the whole web operation. AARON: **They started in the temple of Solomon, right? [Laughter]**JAMISON:  Yeah, that’s what I’ve heard. AARON:  No, so the ECMA community, they’ve commissioned a group of people and they form these committees and they call them technical committees. The technical committee number 39, which is what we hear as called the TC39, those are the group of people that are significant that go to the monthly and quarterly meetings to talk about the progress in the language. So the TC39 is the committee put together by ECMA. JOE:  Sweet. MERRICK:  It’s pay to play, right? Join TC39, you’ve got to pay. AARON:  I have no idea. JOE:  Got it. JAMISON:  Well, let’s talk about JavaScript. AARON:  Alright. JAMISON:  What’s up with ES6? AARON:  Okay. So you guys asked a question though, what’s the difference between ES6 and JS.next and Harmony? What are those things? When I started reading about it, I just called everything Harmony because that’s what I thought it was. But Harmony’s one thing. It’s a bigger thing than just ES6. JOE:  Oh, really? AARON:  Yeah. And ES.next is different than ES6 too. So when the committee’s working on the next API, the next spec, that’s what they call it. Whatever the next one is, is called ES.next or JS.next. MERRICK:  That happens to be ES6 right now. AARON: **Right now, it’s ES6. So when JavaScript 6 is out, ECMAScript.next is still a thing, but it’s a pointer to the ES7 [inaudible].**JOE: **So in the past, they’ve referred to other versions as ES [inaudible] or is this something that just started?**AARON: **I don’t know is ES.next was what they called [inaudible]. It might be a new thing, because back in 4, 5, there was a lot of discord. But now, they agree on a lot more things and they’re able to make more progress.**JOE:  I always thought it was just marketing terms. ES.next like Microsoft came up with the name or something. AARON:  I don’t think so. MERRICK:  So what is Harmony, then? AARON:  Back when they started to disagree, there was a really big release that everyone wanted, couldn’t agree on it. That was where the falling out happened. It stagnated for years. Some people… JAMISON:  This was in ES4, right? AARON:  Yeah, this is on the ES4 over ES3. JAMISON:  The ES4, they tried to do it and then just never came out because they could never agree. AARON: **Exactly. Some people tried to make a [inaudible] release of that and call it ES3.1 [inaudible], I can’t remember. And no one could agree on which way they were going to go. After years, they finally [inaudible]. And in August of, jeez, I [inaudible] the year. I want to say 2011. Maybe it was 2009. I put it down right here. But Eich sent out an email that said, hey, you know we’ve started to make a bunch of progress, we’ve deemed next release, we’re going to call ECMAScript 5. Then all other features, forever, whenever we come up with a feature and we want to put it in the language, we’re going to dump it into this big overall bucket called Harmony. They revved the version of ECMAScript 3.1, they revved it up to 5, because they’re like we don’t want it to be just a .1 release, because we’ve made a lot of progress in our committee here and we’ve come a long way. So we’re going to rev the version up to 5 just to show we’ve made some progress. Then everything else got dumped into Harmony. As they release new versions, they’re picking the prospects for the new language, for the new versions, all come out of the big Harmony bucket. The scope for ES6 is almost entirely finalized as far as what will be in. They’ve already started putting new features into the ECMAScript 7 bucket.**MERRICK:  Cool. JAMISON:  Do you want to talk about some of things that are in ES6? AARON:  Yeah. JAMISON:  What can we expect from the next version of JavaScript or ECMAScript, I guess? AARON:  There are a lot of things and lot of these things come from other languages. We can talk about this in a second. They’ve got things like arrow functions. Some people call those lambdas. They’ve got a new type of lexical scoping. This like let instead of r. One of my favorite features is destructioning. I also like when you couple that with default values. I think that people are going to save a lot of code. JAMISON:  Destructioning like CoffeeScript where you can just pluck properties out of an object? AARON: Yeah. So you can pluck them out on the left of the assignment expression, [instead] of on the right.JAMISON:  Yeah. AARON:  You can actually destructure straight in your function signature, which is nice. They’ve got, it’s called spreading, where you can spread out an array just by prefacing with a … and you can even do, let’s say you call a function that returns an array. You could do … function call and that will spread out the array that returns from the function call. That’s a weird-looking syntax, … method call. It’s actually a weird object name, right? JOE:  Right. Yeah, it is. AARON:  They’ve got proper tailcalls, which is I think significant for performance reasons. They’ve got official sets and maps and they’ve even implemented something called weak maps to help prevent memory leaks. They’ve got equivalent detection to test equality. It’s called egal, which is French for equal. JAMISON:  Checking object equality? AARON:  Yeah. Instead of saying ===, you can say is or is not. JAMISON:  Okay. AARON: [inaudible] new syntax for is and is not. I don’t know why they added that, but that got in there. They have new things for generators, like generators for iterators with will help us write our own type of for loops. It’s like string interpolation and they allow you to do templates. Binary data, they have some [inaudible] improvementsMERRICK:  Are they still doing binary data or are they pulling that out? AARON:  Did you read that they’re pulling it out? MERRICK:  I don’t know. It seems like there’s some speculation about that. AARON:  I haven’t heard anything about them pulling it out. MERRICK:  Okay. Maybe they aren’t. AARON:  I heard it was in, but it might be out. MERRICK: **You want to, I guess, divulge from the top. Why are fat arrows useful? Obviously, [inaudible] script, they do the binding of this for ...**AARON:  So starting from that first feature, the arrow functions. In JavaScript, we all know that finding out what this is, is really fun, right? JOE:  Yeah. It’s my favorite thing. AARON: **This can change, and sometimes what you think this is, isn’t this. This is really something else. [inaudible] pass a callback.JAMISON: [inaudible] to talk about.**AARON:  What’s that? It’s hard to talk about on air, but it’s easier when you have a whiteboard. But if you pass a callback in and it had a reference to this, when you pass it into another object, the this mention is going to be pointing to that object’s this. Anyway, it’s easy to mess up this, especially on those kinds of callback situations with traditional functions. But with arrow functions, it forces the scope so that with the time when the function is created, whatever this was at that time, it’s bound to that this. JOE:  So it’s like creating it and then using the bind function. AARON: **It’s like using bind, yeah exactly. Or saying var me = this and then saying me [inaudible].**JOE: **Right, calls are [inaudible] this.**AARON: Yeah. It’s a replacement for binding everything or aliasing this to something else. MERRICK:  Sure. AARON:  That’s the benefits of arrow functions, I think. They have some weird syntax, though, that people will complain about. But I think we’ll be okay. JAMISON:  People will probably complain about anything they do. Someone’s going to hate any of it. So you just listed a grab bag of stuff there. You sounded like a used car salesman. You got your carburetor and your cam shaft and there’s all this stuff in it. Are there any more important parts you think are going to be huge deals to general developers? AARON:  We can just go through one at a time if you guys want to. We can just talk about JAMISON:  Sure. Maybe just talk about the things you think are most, the coolest. AARON: **At the top of our functions, we spend a lot of time doing something I call data proofing our functions. We spend the first few lines destructuring [inaudible]. If they give us an array, we pull out index 1 and 2 and we do something with that. Or if they give us an object, we pull out its id and store that off and then we’ve got to make sure that’s not undefined, otherwise the internals of the function are going to break. So we spend a lot of time doing something that I call data proofing our functions. A lot of the syntax, the sugar that they give us inside this new release, I think help us with that. Destructuring, that’d make it real easy. Instead of spending three lines to pull three variables out of an object, you can just do it all on one line, the syntax for destructuring. Let’s say you had an object with an id and a name and an address, instead of saying var name = object.name, var address = object.address, and var id = object.id, you could just say var[id, name, address] = object.**MERRICK:  What happens if it doesn’t find them? What if it’s undefined? AARON: The destructuring, that’s a great question. The destructuring, they have a refutable pattern, which you can argue with. The pattern I just told you, var MERRICK:  Sure, the standard destructuring like you see in CoffeeScript. AARON: **That’s irrefutable. If you do [name, id, address], those three things better be there or you’re going to get an error.**MERRICK:  You get an exception. AARON: **I don’t know if it’s, well what kind of an exception is it, reference or if it’s something undefined, I don’t know what it’s going to be. But you’re going to get an error [inaudible], right? But if you preface it like, let’s say you’re not sure if the address is going to be there, you can say ?address and when it’s trying to destructure that object and find its address, if that’s undefined, it’ll be more forgiving, like what we’re used to with JavaScript. It’ll say, “Okay, I’m going to give you an undefined for that value, I’m not going to throw an error.”**MERRICK:  In that case, can you do paths in your destructuring? AARON:  Paths? Like nested? MERRICK:  Yes. AARON:  Yeah. You could nest a destructuring. You can give it a refutable reference inside those paths, as well. You could even alias it. Let’s say they’ve got some weird key value name, you could say name = whatever the weird key was, like if the key was _h, you could say name = _h and it will destructure the _h into the name variable. MERRICK:  Got it. AARON:  You can even do alias, things like that. They’re called destructuring patterns. In your patterns, you have to make sure that you’re using that refutable syntax if you think that there might ever be undefineds coming through. You know what I’m saying? Otherwise, you’re going to get errors. That’ll be some of the fun we get to play around with. Some of the browsers have already implemented this. Firefox has already agreed to implement this. If you pull up their, what’s that word, that web...? JOE:  Dev channel? MERRICK:  Yeah, it’s like a web preview thing. AARON:  Yeah. They’ve got this, I can’t remember the name of it right now, but... MERRICK:  Scratchpad. AARON:  I think it’s Scratchpad. You could write it in there and execute it in Firefox. You can already start to dork around with these things. MERRICK:  It’s essentially a dsl that tells you how to map object values into, well potentially keys into? AARON: **Exactly. That’s pretty cool. I think it’ll save us a lot of time. Instead of pulling them out on multiple lines we’re comma-separating our destructure. [Chuckles]**AARON: **So that’s destructuring. Then there are also things like default values. Let’s say I’m going to pass you an object, but let’s say it comes in as undefined. Up in my method signature, I can say, let’s say the object name I call it in_object, is this object that’s coming in. I could say in_object  = an empty object or in_object = some method call that will return me a default object. Or I could say in_object = new object, [inaudible]. You can do default parameter syntax up in your method signature. You can even put those two things together to destructure an incoming object and give default values, all up in the method signature.**MERRICK: **It’s actually default arguments rather than having to say, “Hey, [inaudible] at this or this value,” you just get it all in the arguments.**AARON:  Exactly. They also have something called rest parameters. If you have a variable number of parameters coming in and you’re not sure how many it’s going to be, like in other languages they call these var args or MERRICK:  Yeah, variable args. AARON:  You can just say, …my_array and you’ll have this array called my_array that’s full of all the remaining objects MERRICK:  It is an array instance or is it a subset of an array instance? AARON: **It’s not a pseudo array like the arguments guy, right? Because we hate that guy. [Chuckles]**JAMISON:  Poor arguments array. AARON:  The weird thing is that inside that rest parameters, that’s going to be different than the arguments. Another thing with the default parameters, if you assign a default value, that’s not going to show up in the arguments object itself. If you’re trying to use default parameters and that gets assigned, let’s say you pass it a number and you give it a default at 0 in case they don’t pass it in, that 0 won’t show up in the arguments object. If you’re still trying to use arguments, arguments will still be empty, even though you have a value for that, that default value you had assigned. There are a lot of subtle weirdnesses you have to get used to when you start using this new syntactic sugar pieces. Those are some of the things I think will clean up a lot of our code and allow us to write a lot less boiler plate and get into shorter functions. JAMISON:  I wonder how many millions of lines of JavaScript have been written just to do all that stuff. It’s cool to think that it’ll add them for you. AARON:  Yeah. JOE:  Yeah. MERRICK:  I know. Yeah, one of the libraries people just like because they can do, this.options. AARON:  I think it will be cool. I think that kind of stuff will be nice. So going on to another feature I think will be huge for people is the new let. Are you guys familiar with let? JOE:  That’s the one that’s scoped according to the block you’re in, right? AARON:  Yeah. JOE:  var but MERRICK:  Is it block-scoped? JOE:  That’s my understanding, block-scoped. JAMISON:  Well, let’s find out. AARON:  It is block-scoping. Currently, we have function scoping, right? JOE:  Right. AARON:  Which everyone loves. Closure-scoping, whatever we want to call it. MERRICK:  Yeah, I like it. AARON:  I know what it is, so I don’t mind it. But some people aren’t even aware about the variable hoisting that happens, that you say, “Hey, dude, that variable you declared on the last line of your function, it actually got hoisted to the top at runtime,” and they’re like, “Huh?” Or each of your for loops, your var i=0, that var i got hoisted to the top of that function. It’s not just specific to the for loop, it got hoisted all the way to the top. A lot of people don’t even understand what variable hoisting is, yet this new syntax is going to come in and make their lives so much better. MERRICK: **Do you see in the future people only using let [inaudible]?**AARON: **Aw yeah, dude. If Internet Explorer can go away, then yes. But if you have to support something that’s not ever going to upgrade to let, then no, people will still use var for a long time. However, there are libraries. Something like Traceur Compiler, where you can write it in new [inaudible]**MERRICK:  I think we’ll save that for the end of the show, how to use this kind of stuff. AARON: **Okay. That’s cool. Hopefully, people will implement let, because it is, I think for performance gains, I think it’s a huge win. I think that’s the big win. Instead of an if statement, you put your C hat on. Okay, after my [inaudible], if I do a new variable inside of this if closure, it’s not going to hoist out. That’s what some people coming into JavaScript thinking it’s happening and it’s not. It’s getting hoisted to the top of that.**MERRICK: **It’s getting allocated [inaudible].**AARON: **So after the if statement, that variable’s still around if you give a new definition inside your if. It’s still there with that definition. It’s not releasing the reference to that. Using let, if you were to do an if statement, you do let a = 0, as soon as that if closure’s done, that if block, then a’s gone. It’s not equal to 0, it’s just gone. They released it back to the [inaudible], which is pretty cool. I think that’s huge. Another tool that they gave us with that is they gave us things like let expressions and let statements. Those act almost exactly like an if statement. You can say let and then you have parentheses, you can say x = this, y = that, z = this.MERRICK: [So you’re] using the comma operator [inaudible].**AARON:  And then you give it a block, like an if statement, an opening and a closing brace and you could do some code in there, and after that let expression’s done, those will get cleaned up. Another option on that is they’ve got block scopes where you can just drop down some curly braces, wherever you are, and you just have a short-term block just because you want to. MERRICK:  Are they going to allow you to reference blocks and pass them around? AARON:  I don’t know. MERRICK: **In Ruby, you obviously could do that, but it seems like in JavaScript, I don’t know how you even infer that it’s not an object literal on the [parse stack]. I guess if they’re not key values.**JAMISON:  Blocks in Ruby are more like anonymous functions in JavaScript than the way we’ve been using the word block. MERRICK:  Yeah, but I’m wondering if they’re going to actually add block scoping if you are going to be able to reference a block and pass it around almost like a pseudo include. JOE:  Yeah, and close over variables. If you can pass them around, then it’s got to, would it support closures? AARON:  I’m not sure. MERRICK: **Well, it would work more like an include than a closure. In Ruby, you have [inaudible].JOE:  If you define a variable outside of the block, throw a block in and reference the variable, then you can take that block and… MERRICK:  Yeah, it would have to close over that. JOE: [inaudible], closing over it?**AARON:  Yeah, I’m not sure exactly how this’ll work. MERRICK:  Maybe we’ll just keep using closures. Closures are great for that. JOE:  Yeah. AARON:  Yeah. One thing that people need to understand is you’re not going to go through your code and replace all var with let, otherwise you’ll break the internet. Even though you don’t understand variable hoisting, your code works right now as it is, because variable hoisting exists. If you start just replacing everything, all of a sudden a bunch of variables that were being hoisted aren’t and your code breaks. You just need to aggressively do it, but watch it. You can’t just blindly start replacing that… JOE:  Does let still get hoisted to the top of its scope? AARON:  That’s an awesome question. I was wondering that. I thought the answer was yes. But Domenic Denicola, how does he say it? JAMISON:  I think it’s Denicola. AARON:  So Domenic, he corrected me on Twitter, because I had that same question. Is the let expression inside of an if, is that going to get hoisted to the top of the if? So they have this thing called the temporal dead zone. JAMISON:  Oh man, that sounds like it’s some sci-fi magic. AARON:  I know dude, that’s what I said. I was like, “What are you talking about?” JOE:  It’s the most awesome name ever. AARON:  It’s just a hack to, I think under the covers it’s getting hoisted. But they’ve created this hack called the temporal-dead-zone where magically, it won’t be there. But as far as you’re concerned, it doesn’t get hoisted. At least it won’t appear to have been hoisted to the top of its block. But I’m pretty sure it’s getting hoisted to the top of its block under the code. But they have this thing called the temporal-dead-zone. MERRICK:  What if you try to access it before… AARON:  If you try and access before, you’ll get an error. MERRICK:  Whereas otherwise, you’d get undefined? AARON: Yeah. JOE:  Interesting. AARON:  **Go and read it. If you go out there and check out the internet about temporal-dead-zone in JavaScript, you’ll see. Some guys, I was talking to [actual] about [inaudible]. We were having a couple of chuckles about it. But I’m happy it’s there, because now your code will run like it looks like it’s going to run, which I think is an important thing, to have the execution look like what it is in your editor. Right now, the execution doesn’t look anything like what you wrote.**JOE:  I really want to run out and register temporaldeadzone.com. AARON: **Pretty sure it’s dead. [Laughter]AARON: .org? [Laughter]**JAMISON:  .edu. MERRICK:  So let’s talk a little bit about generators, because I know people are going to start using them in Node today. AARON:  Yeah. Generators already exist. Actually, generators have been in Firefox for a really long time. JOE:  Oh, really? AARON:  And I wasn’t aware of that. I didn’t know that. A lot of these things we’ve been talking about, like let, that’s already in Firefox. These things have been on there for years. Firefox has helped the TC39 by implementing these things and then giving them feedback on this is how people are using these things. What have you heard about generators? What are you excited about? MERRICK:  I’ve heard of people combining generators with promises to write more synchronous-looking JavaScript, even though it’s asynch. Also, just the performance aspect of it. AARON:  I think just being able to pause that kind of an execution, I think people will use generators for exactly what you said. I don’t know that most JavaScript users will use generators. I feel like a lot of library builders will definitely use generators. But I wonder if everyday users are ever going to use these things and understand what yield is and when not to yield and when they should stop yielding, or if they should stop yielding. I don’t know. I wonder. JAMISON:  Can we talk a little bit about the module system? That’s a huge area, but my biggest question mark. AARON: **Yeah, I don’t think that they [inaudible]. I don’t think they finalized the module system.**MERRICK: **I think it’s [inaudible].**AARON:  Is it? MERRICK: Yeah. AARON:  It’s still up. That’s one chapter I haven’t gotten to in this book, is the modules, because it isn’t stable. I’ve already worked on a couple of chapters where they weren’t stable and had to rewrite the whole thing. So unfortunately, I don’t know as much about modules as I should. I do know that they took a careful look at AMD and the CommonJS modules and looked at those two approaches and ended up with a completely different one, a third one, which some people are excited about and some people weren’t excited about. Some of the Googlers were like, “What is this?” and some of the other people in the community were like, “Hey, this is great. At first I didn’t think I’d like this, but I really do like it.” I don’t know. But you could already use those. JAMISON:  Hate it more than being punched in the face, though. AARON:  What’s that? JAMISON:  I said some people hate it more than being punched in the face, because it’s different from anything that’s out there already. AARON:  Yeah, which is frustrating. I don’t know. I need to dive into those more. MERRICK:  One of the features I think is really cool is template strings. Can you talk a little bit about those? AARON: **I don’t even know if that spec is all the way finalized. But we all, inside of our code, we’ve always dealt with template strings. Some of us do, we don’t have multiple line strings and with these clauses, we get multiple line, which I think will be nice. I think that when you’re working with pluralizing or localizing your strings, I think that these [inaudible] strings can totally help by allowing you to just [inaudible]. It uses syntax we’re all pretty familiar with. The double curly braces to wrap around your variable names. It uses those when it sprinkles your stuff into strings.**MERRICK: **I had the chance to go to GothamJS and Domenic actually spoke there about ES.next and he talked about template strings and how you can actually return something other than a string. One of the examples he used was in Node.js to shell out and call a system command, you could simply use a template string and return back a child process. We can use template strings to implement these little [ESLs] throughout our app.**JOE:  Sounds pretty cool. AARON:  I think there are huge issues. One thing that, when I was reading about it, at first I didn’t understand. It’s almost like it’s a function. You create this little quasi-generator thing and then you end up invoking it like a function with some text afterwards. And it spits you back, as Merrick said, a string which is how a lot of people will use it, but you could also make it return not a string, return another thing besides that. I think it will be interesting how people will decide to use. MERRICK:  Yeah, it’d be weird. AARON:  the quasi-generator stuff. It’ll be exciting though. It’ll be really cool. People have done crazy things will all the different things that people have ever implemented the language in. With the ability to monkey patch JavaScript on the fly, it’s going to be interesting to see what people do with these generators. So we’ll see, with the quasi’s, we’ll see. JOE:  One of the things I really wanted to hear from Aaron is Aaron’s made some fairly controversial statements about IE and I think that this’d be great to just put onto the show, because I think there’s a lot of information that he’s spit out that I haven’t really thought through before. I’m thinking, “Oh, Microsoft’s been talking about IE is now an evergreen browser.” AARON:  Yeah. I can talk about that if you guys really want to put that on the show. MERRICK:  It’s your opinion, not ours. JOE:  Let’s just keep our comments not to the Microsoft sucks but up to what the trend has been. AARON:  I just think, I just get scared every like intentionally supporting Microsoft. After watching what happened with Windows XP… JOE:  Let’s be specific here. IE, right? AARON: **Yeah, with IE. Windows XP got stuck on IE8. They’re never going to get better than IE8. That’s an issue for a lot of us, because when you’re talking about Windows users, these are people who are tied to a specific version of a browser. If they’re IE users, they’re limited in how advanced they’re going to get. When you look at Microsoft struggling and thrashing to become an evergreen browser, I’m not sure they ever will become truly an evergreen, because in an evergreen world, Windows XP never would have lost support for IE9 or IE10. I just worry that with Windows 7 being so big and it’s coming to a point where they’re going to decide to stop supporting it eventually, possibly, I’m just worried that that’s going to become a non-evergreen operating system. We’re going to be stuck with IE10 being the best that Windows 7 can ever get. So if we’re developing for IE10 now, we’re in the same spot we are with IE right now, where everyone hates it. People are [inaudible], IE10 or IE11 are standards compliant, but that’s only today’s standards. IE8 was compliant when it came out. If IE10 is the last thing that Windows 7 ever gets and we get four years down the road, we’re all going to be cursing it. I get nervous about anything specific to IEs, just because they are an unknown. They don’t have a proven track record like every other browser out there does. It just makes me nervous and the amount of cost that goes into building an awesome app is great. Then once you hand it off to QA and they go test it in IE, it doubles your effort to make that awesome app work in IE8. It’s [inaudible] that I think is troublesome.**JOE:  How much money has been spent? AARON: **Yes, talking to [inaudible], he made some good points, though. If this is your [market share], let’s say you’re competing with Google and Google is abandoning IE8 and you see a niche, someone like Yahoo, they don’t get nearly as many views. But if they start supporting IE8 and doing things for IE8 that Google’s not going to do anymore, maybe they’d get a lot of money out of that. You never know. It could be a place for a lot of people to get started and make some money, but larger companies, I don’t know if they’ll focus on it as much. But I don’t know. Why would you focus building a website for the browser of yesterday, when you could spend that same money building the website of tomorrow and with really cool features? You don’t have to worry about these weird, “Oh it’s IE in some strange compatibility mode for IE [inaudible]. Who put it in that mode?” Who knows? I don’t know. I think that it merits. If someone said that they wanted to do it and had a good business reason, I think it would make sense. But if you have limited capital, I don’t know. I don’t know if it makes sense.**JAMISON:  So let’s bring it back to talking about ES6.  What can you do to use it today? You mentioned the Traceur Compiler? Then I think Firefox has lots of them and now it has a flag to enable Harmony. What other stuff can you do to use it today? AARON: **On Node, you can use whatever is implemented in E8, or anything that’s monkey patchable. If they can put it in there, you can use it. If it’s shimmable, you can get it in. If not, if you [inaudible] for the front end, you’re roped to an IE8 environment, Traceur Compiler is the best thing I’ve seen. But it’s still fairly limited. But it’s a library that allows you to write ES6 code and then you have a compile stage where it will transpile it into something that even IE8 could speak. Let’s say you use the word let, like you say let a = 0, if you do that in IE8, you’re dead. It’s going to die. How do you compile let into something IE could speak? How do you get the functionality of let? How do you get the same function out of var that you were expecting in let? It’s tough, right? Well they’ve figured out some really clever things like there’s only one place in the whole of IE8 JavaScript where you can get short-term scoping like what you’re expecting with let and that’s if you do a try and you throw an error in that catch. The e, your error that’s in your catch signature, that is a short-term block. That doesn’t get hoisted. So they’ll compile your let into a try, they’ll throw an error, get into the catch and then they use that error variable as the let variable. They’ve done some really clever things to try and mimic what let’s going to do for IE8.**JAMISON:  Wow. JOE:  Just out of curiosity, in other languages, the ones I’m familiar with, throwing an error is an extremely expensive operation. AARON:  Yeah, I don’t know. MERRICK:  I’m sure it’s slower. AARON:  I’m sure it’s not fast. But you’re trying to what you can and there’s no other way to mimic that. I thought it was pretty clever. Is it more expensive than doing a never-ending line of closure? Who knows? I haven’t really tested. JOE:  In C#, it definitely is. It’s really… AARON:  It’s a big deal? JOE:  Big deal. AARON:  Yeah, I don’t know. I’m not sure. JOE:  That’s really interesting. Very clever, though. AARON: **It is clever. When you go through and look at what they’re doing, you write the code and you have it transpiled and look at it, some of it’s sick. These people are twisted in the head. [Laughter]**AARON:  They thought it up. It’s nice to have someone do this. Talking to them, they were like, “Yeah, we go to the TC39 meetings and we head back and try to implement some of the changes. JOE: **Sounds like it was all written by Merrick [Colms].**AARON:  Seriously, I look at them and I’m like, “These guys are like Merrick.” They’re great and I love that they’re building. I can’t help them out though. It’s advanced stuff. MERRICK:  It’s insane. AARON:  Yeah it is, it’s insane. JAMISON:  So I had one more philosophical question about ES6 as well. It seems like there are two different approaches you could take with designing a new version of a language. One is the pave the cow paths approach where you look at things that people are doing and you make them easier. It seems like they’ve done that with the argument destructuring and the default arguments and things like that. Just, “Hey, people are writing lots of code to do this. Let’s make it easier.” The other path is more prescriptive where you say this is the direction that I want the language to go, even though people aren’t doing things like that already. Do you feel like ES6 is leaning more toward one side or the other? Are they trying to enforce changes in how people write JavaScript or are they trying to make it easier for people to do things they’re already doing? Or is it a mix of the two? AARON:  With let, they’re obviously trying to force people to do better things. But they also have a big mantra, which is they’re going to adopt de facto standards from the community. That’s where arrow functions came from. A lot of other languages have that syntax. So people understand what it is. CoffeeScript’s got fat and skinny arrow functions. MERRICK:  Destructuring, too. AARON:  Right. And destructuring and the var args. Anyway, they’ve got a lot of things and they’ve said, we’ll adopt de facto standards in place of pioneering new stuff, where we can. I really think, when I look at ES6, I look at, wow, there’s a lot of stuff other languages already have. They just picked what they liked the most and what they’re able to standardize into JavaScript without breaking the internet. It’s all really exciting for me, I think. I don’t know if I answered that question right. JAMISON:  No, it makes sense. Just a mix of both. AARON:  Yeah. JOE:  Well, should we wrap this up? AARON:  Yeah. MERRICK:  Yeah. JAMISON:  I think so. Do you have any last thoughts on ES6? JOE:  In three words, what’s your very favorite feature in ES6? AARON:  Destructuring, default parameters. JOE:  Cool. JAMISON:  Sweet. AARON:  Modules? I don’t know. JAMISON:  Oh, cool. AARON:  Modules, probably. I should say that modules’ number one. MERRICK:  Yeah. There’s a ton of stuff for ES6. We barely scratched the surface over here. There’s class semantics. AARON:  Can I say my least favorite? MERRICK:  Yeah, of course. AARON: **You just said it. Class semantics. [Laughter]**MERRICK:  Yeah, there’s a ton of them coming. JAMISON:  You should plug your book, Aaron.  I was going to ask, where can people go to learn more about this stuff? One of them is your book, right? AARON: **Okay. The short one we published in May is a free read on O’Reilly site. It’s called JS.next: A Manager’s Guide. It’s a book that you would hand to your manager if you’re a developer and say, hey this is some good explanation about the new language, a good explanation about the efficiencies of us moving toward it and abandoning older standards. It gives you a lot of good arguments and community examples of people moving toward it and I talk about how I think that’s going to make them successful. The other one, it should be out in a short release, in a [inaudible] release version, hopefully by the end of September. But it’s called ES6: A Developer’s Guide. It’s a [inaudible] guide for ECMAScript 6. It talks about all the different features and gives you code examples and explains it.**JOE:  Awesome. AARON: **Yeah, I’m excited. It’ll be fun. One thing I should say about ECMAScript 6, the spec doesn’t officially, they don’t finalize it until December of this year. Then [inaudible] give it 12 months to be officially approved as the official ECMAScript 6. So it’s not going to be official until December of 2014. However, it’ll be finalized in this year’s December and they go into a hardening phase where only bug fixes will go in after that. It won’t be official until a year and a half from now and there’s a reason they have to do it in Junes or Decembers. They couldn’t get it into this June, but it just passed, so they’ve got to wait until December. The book will be out way before it’s done, though. You can start learning it and using it right now if you wanted.**JOE:  Cool. JAMISON:  Awesome. Let’s dive into the picks then, since it sounds like you guys have to take off. Joe, do you want to start? JOE:  Sure. I’m going to make two picks. I went last night and saw Pacific Rim and I really liked it. I didn’t love it, but I really liked it. I saw it in 3D Imax and I thought it was worth, you know Guillermo del Toro, such a visual director. It was really cool in 3D Imax. So I’m going to pick that. I’m also going to pick, I think I’ve done this a couple of times, but That Conference, just because they have a bacon bar, coming up in August. Actually, in just a couple of weeks. A week away from when this gets published or something. Two weeks right from when this gets published. But bacon bar, got to love it. JAMISON:  Awesome. Merrick, do you want to go next? MERRICK:  Sure. First is a band called PHOX. They have a video series on Audiotree and it’s really interesting music. They’ve got a lot of instruments going on at once. The do it in a really interesting way. The second is, recently I had the opportunity to go speak at GothamJS and I got to meet just some awesome people down there. A lot of them were listeners and they had a lot of kind words to say about the show. So really, I just want to thank our listeners. I’m grateful we have people on the other end of these bits. That’s it. JAMISON:  You’re the sweetest, Merrick. I’ll go next. So I have a bunch because I’ve missed a few shows. My first pick is, I think for remote teams, called Sqwiggle. You connect to the site and it turns on your webcam and it takes a picture of you periodically every few seconds. It does that for everyone. It gives you a little dashboard of your whole remote team. You can feel like you’re there with them, but then the cool thing is when you actually want to talk to them, you just click on their portrait and it turns into a video conferencing thing. It just seems like a really cool way to try and recreate the feel of having a team in the same place. You see all your team on your screen, even though you’re not talking to them directly. But then when you want to, it makes it really easy. My other pick is NodeConf. Oh my goodness, NodeConf. NodeConf was the best conference I have ever been to by far. It was amazing. I had a similar experience to Merrick where there were lots of people I met that listened to the show and that was cool. It felt really surreal. But it was just incredible. I met lots of great people. There’s a blog post by Isaac summarizing his experiences with NodeConf and I think he does a good job of describing why it was so fun. So that’s my pick, NodeConf and Isaac’s blog post about it. The last one is an album by a guy named Jon Hopkins, it’s called Immunity. It’s ambient electronic music. It’s wonderful. It’s really great to listen to while just coding. It’s probably my favorite album of the year so far. So those are my picks. Aaron, do you want to go last? AARON:  Yeah. I’ll pick a movie, because there’s a movie thing. I want to pick Tombstone. Watch this movie. MERRICK: **Oh, I love that movie. [inaudible]**JAMISON:  The whole western one? AARON: **Yeah. The Val Kilmer one. It was [inaudible].**MERRICK:  “Tell them I’m coming. Neil’s coming with me.” So good. AARON:  Yeah. I’m going to pick Tombstone. I’m going to pick Justin Timberlake’s latest album for my music. It’s a good coding vibe on it. Then I’m going to pick a PolymerJS. They did a screencast this week about all the stuff they’re doing with web components and it’s pretty sick. I’m pretty excited for PolymerJS. JAMISON:  That’s sweet. AARON:  My picks. JAMISON: **Awesome. Well thanks for coming on, Aaron. I’m sorry I had to make you share a room with Merrick and Joe. Must be [inaudible] together.**JOE:  I’m going to put one last thing out there. If you happen to be going to That Conference, please come and find me and say hi. JAMISON: ** Awesome. Alright. Well, we will catch you guys next week. Thanks for coming.

Sign up for the Newsletter

Join our newsletter and get updates in your inbox. We won’t spam you and we respect your privacy.