« first day (2412 days earlier)      last day (2536 days later) » 

10:32 PM
 
a 4.5 second build?
 
I made a plugin for webpack that displays module hashes as emojis. That way, you can see the things that change better.
 
all my builds take between 20 and 60 seconds
 
my app took 4.5 minutes to build earlier today.
 
@KevinB We are just starting webpack. Loving it
 
10:34 PM
I don't love it yet
 
Well, start.
 
not till i can figure out how to make it insert the script tags where i want them to go
 
    const crypto = require('crypto');
    const emojiList = require('emojis-list');

    function getHash(string){
      const hash = parseInt(crypto.createHash('md5').update(string).digest("hex"), 32);
      return isDev ? emojiList[hash % emojiList.length] : hash;
    }
for anyone who cares
 
I'll take that, but not for sticking emoji on my webpack output
 
webpack **Dev output
Oh, I misread that.
 
11:00 PM
why does using arrow functions in objects
give undefined
for this
 
the arrow function doesn't change what this is bound to, so if it was undefined outside the arrow function then it will be undefined inside it too.
you will need to show more code for us to determine why it's undefined in your case
if you set it up correctly then you can make this point to whatever you like
 
Thats all I needed
just trying to understand
so if i just do increment: () => this.value += 1;
the this is refering to the window?
 
this in an arrow can never refer to window
 
really?
 
it's undefined at the top level scope of a module
and es6 can't exist above that, so unless it's getting turned back into an es5 function, it should never be window
(i.e, transpiler bugs aside)
 
11:05 PM
you are 100% wrong
just type (() => console.log(this))() into the chrome console
and you will see
 
the console isn't a module
 
ok well would the best way to define a function in an object be
 
I may be wrong, but there is a rule about what this will be at the top level, and it shouldn't be anything defined.
 
increment() { this.value += 1;}
 
@ssube you're the only one talking about modules, and even inside a module you could make it refer to window
 
11:07 PM
@david the console breaks a lot of rules, it's not a great test :)
 
@ssube, then try it in an html file, it works there too
i think you've read something somewhere and misunderstood it
arrow functions don't change what this refers to
so if you have a situation where this refers to window, and you create an arrow function inside that scope, then inside the arrow function this will still refer to window
 
obviously
there are cases where this isn't window
strict modules, for example, which arrow functions seem to be explicitly excluded from
 
you said "this in an arrow can never refer to window", which is 100% wrong, and i have shown you that it's wrong
@JohnSumner how are you creating your object?
 
@david modules don't have a this, which is what I was thinking of. Apparently arrow functions are excluded from that.
Presumably so they act like legacy functions.
 
11:13 PM
@JohnSumner that code seems to work? You're not including inc in the method parameters though
 
yeah thats my mistake
the code works
was just wondering about arrow functions in objects
 
that's not an arrow function
ah
but if you change it to an arrow function it stops working
i get you
 
yeah
because this is undefined
 
@JohnSumner because your transpiler is following the rules
in fact, babel goes directly to the final conclusion: undefined.value += typeof inc === 'number' ? inc : 1;
 
yeah I understand why it doesn't work now
 
11:17 PM
it has nothing to do with transpiling ><
 
it's all part of the effort to prevent modules from getting at the global scope. I'm not sure why they excluded arrow functions from the strict mode implications of that, but otherwise, you'd have to jump through some hoops to get at it.
 
that code will run natively and still have this as undefined
this isn't in a module!
 
@david right, that's what the spec requires
you can see it easily in the transpiler output
 
i don't know why you're talking about transpiling and modules
when they are 100% unrelated to this
 
babel spits out a good example
 
11:19 PM
*this issue, not this
i don't care what babel spits out
 
you should, it's rather informative on what will happen
 
i don't need babel to tell me what will happen ><
 
in general, it's a nice way to see what es6 will end up doing in simpler, es5 terms
 
i know what it will end up doing!
 
that's cool
 
11:25 PM
@JohnSumner Here's an example where the arrow function does point to the correct this: jsfiddle.net/k1p3wmjw
because when you create the arrow function (inside the oldschool constructor) this is pointing to the correct thing.
 
yup
I understand that now
 
sweet
 
@SterlingArcher I weighed in at 86.1kgs this morning. Having a cold all week seems to have been a good thing!
 
@Trasiva which timezone?
 
@SterlingArcher Also I read that last part as your boyfriend keeps going down on you
 
11:53 PM
ahahah that usenix article in the starred list is hilarious
 

« first day (2412 days earlier)      last day (2536 days later) »