Comment Re:encouraging (Score 1) 89
Promises do have applications in all sorts of async tasks though.
[ begin_rant ]
I agree they're over-used, but it's hardly the end of the world. Even the polyfill versions of them are performant enough that you're unlikely to hit their limits. And if you are, it's a good sign that you're abusing them!
Personally, I think a much bigger problem is the clusterfuck way in which stuff gets standardized into JS (now ES). From Promises (yes, I sort of agree with you!) to the insane drag-and-drop API, it seems like the JS world tends to simply pick whichever implementation "got there first" and standardize on that, with nary a consideration for whether the resulting API is sane to use. I mean, when IE 5.x is your reference impl, you just *know* that something is up... That's how you end up with "oh, none of this works until you return false to this handler" and shit like that. And why you have both 'dragover' and 'dragenter'. I guess because the Outlook web team didn't want to maintain event counters?
One of the best programmers I know -- responsible for some *seriously* widespread libraries that pretty much swept the games industry -- always says: "try to write the calling/usage code before you write your library. Because if you as a future caller can't use the API you had in mind, it's crap."
And I tend to agree with him. There's a lot of stuff where that falls over, and I can only imagine it was because the spec/lib authors didn't really think through a real-world use-case for the stuff that they were turning out. If they did, they'd probably have made some changes. (Even Sun, who did a great job with some stuff like the Collections API, has plenty of these architectural brain-farts, particularly surrounding authentication and authorization. They built something super complex and flexible that nobody in their right mind can actually use, so everybody uses a third party lib or two which offer a simple, sane API.)
React actually isn't too bad, particularly compared to Angular or similar! As a functional programming fanboy, I dig the "data drives UI changes" model and the one-way data flow. But "native" DnD, file upload? It's pretty clear that nobody thought through how it is to be on the receiving end of those APIs before ship time. Is it doable? Sure. I've written plenty of code that deals with the "raw" DnD API. But it's damn sure not easy or pleasant! It's hack city because too much was left up to the browsers, and across three browsers you got four opinions on what events should look like. Not to mention the flat-out bugs that nobody cares about fixing because, fuck it, handling backwards compat. is hard! Yeah, you can do it (or use a lib if your use case fits it -- ours didn't), but for something that should be simple and should be a total non-issue, god*damn* did they make it complex.
The interesting thing about JS is that new additions are rarely straight-up terrible. They're usually just sort of "death of a thousand papercuts" bad. No one standout, but a bunch of really annoying bits that make the whole experience an exercise in pain compared to, say, writing for Cocoa or even
On the other hand, ESWhatever got just about everything right with lambdas, so it's very much a mixed bag. Not quite right on the JIT optimizations (at least on FF), but I'm sure they'll sort that out soon enough!
So yeah, go lambdas. React? Eh, getting there. Drag model? Fuck that noise.