Theodoropoulo: I wrote my first js programs with emulation of java cl***es
Radell: I do not even want to think of it
Hommer: Silverstick, possibly async issue
Turbin: Silverstick, read some guide on custom html5 validation messages
Wakley: Helfert: In JavaScript, verbs are equally important as nouns. http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html
Brissett: You needed some stup/configuration option for them to work
Straight: Oh right you already pasted it
Straight: It’s an amazing rant.
Trucchi: Basically, you want the event handler to be a function that reads the error, translates it into something a user will understand, and then updates the DOM with that
Springate: I gotta run, next task waits
Linzie: Straight: Now consider it applying to array.forEach!
Straight: Buu: in favor it of, or against it?
Linzie: I’m not sure it’s that simple
Straight: True. i argue for forEach because it’s a gateway drug to the real iteration methods – once people graduate to those, then i suggest not using forEach
Straight: But forEach is still better than a loop :-
Trucchi: Yeah, I was gonna say – it’s pretty rare that I’ll actually use forEach, heh
Trucchi: Because usually I want to transform an array, or find something out about it, not just perform side effects
Linzie: Well, I refuse to type var i ilength i++; on general principles
Linzie: But .forEach is not exactly filling me with joy
Usman: I type it on professors
Trucchi: Feel the love of for.of!
Helfert: Straight: out of curiosity, the real iteration methods would be map, reduce etc.?
Usman: I spent so long getting out of loops that for of still feels dirty jaawerth
Straight: Helfert: yup! and filter, some, every, find, findIndex, reduceRight, etc
Linzie: Straight: Hey, that looks exactly like perl
Usman: ReduceRight = reduce from last to first?
Usman: It’s es6 only too right? I still haven’t set up a babel environment yet
Trucchi: I mean, I’ll often use a function instead for composability
Helfert: A while ago i read a quote about the post-functional programmer who knows the beauty of iteration methods but still uses loops for performance — is that still true?
Trucchi: Usman: it is, but it’s native on current chrome and node 4.0
Straight: Usman: reduceRight is ES5. and yes, it’s reduce, backwards.
Straight: Helfert: some do. but that level of performance is almost never needed.
Trucchi: All you reall need to for.of other than supporting the syntax itself is support for Symbols and therefor Symbol.iterator, which for.of looks for
Straight: Helfert: it’s easy to speed up clean code, for example, by turning a .map into a for loop. it’s harder to clean up fast code.
Trucchi: Of course, the real magic comes when you use it with generators
Trucchi: Like function* flatteniterable { for let item of iterable { if typeof itemSymbol.iterator === ‘function’ yield* flattenitem; else yield item; } }
Trucchi: That will flatten any iterable – Arrays, Maps, Sets, objects that have been given a Symbol.iterator. spec-compliant iterators themselves
Straight: Trucchi: or function flatteniterable { return Array.fromarr.reducefunction flat, toFlatten { return flat.concatArray.isArraytoFlatten ? flattentoFlatten : toFlatten; }, ; };
Straight: No generators or for.of needed, fully pollyfillable.
Trucchi: Only now you’re creating intermediate structures
Straight: Which the JIT will optimize away
Straight: Since all those functions are pure, it’s pretty inlineable
Trucchi: I still see benefits to the new syntax though.
Trucchi: In the real world, at the moment, I’d do it your way unless speaking specifically to an ES6 audience, so to speak