Seegmiller: I actually semi understand promises, generators, and async/await stuff now
Graciano: Hello, I’m sort of in a blackbox situation. I have a web app that’s calling this code https://jsfiddle.net/z1v0rwL5/ in an ininite loop and my job is to reverse engineer it to find what’s causing that loop. Any tips on where to start?
Goynes: Where’s the infinite loop, in your client code? bewilled
Bazinet: Bewilled: in your debugger?
Plata: Games: that’s cool : Generators and async/await are particularly complex, but you’ll eventually get them as well :
Hender: Bewilled: I’m guessing “hello” is printed repeatedly
Titone: Games, The word hello is whats getting printed
Hender: Bewilled: replace “console.log” with “debugger;” and then when it hits the breakpoint check out the call stack
Hender: You might need to open up dev tools for the breakpoint to fire
Nagele: Dolby: async/await seems more straightforward to me than generators do
Baldon: Thank you lotus, will get it going
Leverson: Games, async/await is built on generators
Adrian: Games: async/await is definitely easier to use. But it’s conceptually challenging :
Trame: Maybe in the background, but using them is not as odd
Konopacki: Games: Generator – JavaScript MDN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator
Hender: If ‘0’ { console.log’True!’; } if ‘0’ != true { console.log’Not True!’; }
Idiart: Lotus: those are two very different expressions :
Vantine: Dolby: does the first expression test only for undefined
Haggerton: Well it gets a string object, and that’s true i guess
Gemmel: I feel like a clean language doesn’t coerce booleans ever
Konopacki: Dolby: The ‘falsy’ values in JavaScript are undefined, null, 0, -0, NaN, ”, and false. The ‘truthy’ values are all other values. All objects are truthy. There is nothing both truthy and falsy, or neither truthy nor falsy.
Unsworth: The second is much more complicated.
Konopacki: Dolby: Found: 11.9.3 The Abstract Equality Comparison Algorithm http://es5.github.io/#x11.9.3
Meneus: Lots of dynamically typed languages coerce values
Meneus: Or not-so-typed languages, as it were
Meneus: You can also use ! to force a truthy/falsy value into an actual boolean value
Konopacki: Meneus: boolean false
America: Because !’bananas’ results in a boolean false value which now means you can ! to result in a boolean truth value
Froneberger: So a generator is kinda like a state engine
Schleider: How is it any different from a closure other than being more opinionated
Bargo: You can iterate through them.
Sparano: You could provide a next function in a closure to do the same thing though
Dicioccio: Or is the idea that this is more semantic and singularly-purposed
Bazinet: Games: it’s exactly like a closure that takes a function argument and repeatedly calls it
Benberry: It’s more semantic so it can be used with for.
Bazinet: Games: except for the syntactic and API features, obviously
Shacklett: It was taken straight from Python.
Covarrubio: My python-fu is too weak to have ever been exposed to generators lol
Dauphinais: Seems like node is pretty much es6 by default, like we’re within a few days of it being official
Shahinian: B const range = function*begin, end, step { for let i = begin; i end; i += step { yield i; } }; for let i of range0, 100, 2 { console.logi; }
Grinde: I think there’s no point in not going es6 production now
Shahinian: Hmm, is the es6 bot dead?
Hofler: Rcyr: can you mix generator syntax with arrow functions?
Shahinian: Games: Not that I know.