On Sun, Oct 21, 2012 at 2:16 PM, Brendan Eich <[email protected]> wrote:
> Domenic Denicola wrote: > >> (Attempting to send again with fewer URLs to avoid being spam-filtered? >> Apologies if this shows up twice.) >> >> On Monday I'll be giving a talk about ES6 at EmpireJS. I just finished up >> my slides, and would love some feedback and critique from the es-discuss >> crew: >> >> https://jh2kcg.sn2.**livefilestore.com/**y1pLp4Fh3CL9rp5A__EenS-** >> TzdbQJMwG8IeIzQ_**aRUbd6GakGmTcdBxx9Ec5SpKyfdHrD** >> F0lFXr9sGfQJJVswnNAw/ES6%20is%**20Nigh.pdf<https://jh2kcg.sn2.livefilestore.com/y1pLp4Fh3CL9rp5A__EenS-TzdbQJMwG8IeIzQ_aRUbd6GakGmTcdBxx9Ec5SpKyfdHrDF0lFXr9sGfQJJVswnNAw/ES6%20is%20Nigh.pdf> >> >> The slides consist primarily of code examples of almost every new >> feature, so accuracy checks and ES6-idiomaticness-improvements would be >> very helpful. >> > > Really nice slides! Good work. > > Quick notes: > > Slide 15 has a comment at the bottom: // error! used a `let` before > declaration > but this error is about the most-indented log call, the one in the block > whose last child is 'let log = Math.log'. Perhaps you are going to talk > around it, but it seems to me a comment about an error should go right > where the error is. > nit: The comment itself says "// error! used a `let` before declaration.", might be nice to highlight that the error will occur until the let is assigned, ie. I can initialize it, but reads will throw until it's assigned. Not sure of the number, but there is a slide titled "Block Scoping" with this: if (Math.random() > 0.5) { function go() { console.log("gone!"); } ... } assert(typeof go === "undefined"); I'm not sure I get what this one is trying to illustrate, because "go" will always be initialized, regardless of the condition if (false) { function go() { console.log("gone!"); } } typeof go === "undefined"; // false go(); // "gone!" new Set(...document.body.children); is a Syntax Error, use: new Set([ ...document.body.children ]); Same for: new Set(...array) Math.max(...array); Math.max(0, ...array, 5, ...array2); new Date(...dateFields); array.push(...array2); I'm STOKED that you title Template Strings as such... good to get that word out. new Set([...document.body.children]) Weak Sets aren't specified yet. Might be wise to omit that? One of WeakMap's best use cases is private data... (function(exports) { var priv = new WeakMap(); function C() { this.public = "hi!"; priv.set(this, { secret: "I will never tell!" }); } C.prototype.guess = function( attempt ) { if ( priv.get(this).secret === attempt ) { // ...unlock } else { // ...stay locked } }; exports.C = C; })(this); ... This way any number of methods, both on C's prototype or class-side functions, as long as they are defined in the same scope that "priv" is bound to, can access the private cache in "priv". This beats leaky plain object abstractions for a serious win :) Rick
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

