Echo JS 0.11.0

<~>

MaxArt comments

MaxArt 2946 days ago. link 1 point
Hm... no.
It's pretty clear that the strongest point of JavaScript isn't being an OO language, but still... classes in JavaScript have always been there and this hasn't prevented us creating excellent things with JavaScript.

Rather than avoiding classes at all costs, it's better to find a way to use them properly. For example, I think React's usage of classes makes perfect sense (although some purists push for stateless components and thus can be represented by the sole render function). Not to mention, in some cases we're actually forced to use classes (when defining custom elements, for example).

I've always found the argument "`class` is syntactic sugar that confuses us" pretty weak. Yes, `class` still yields prototypal inheritance. Yes, there are some quirks behind. But, as professionals, we're to learn all of this and take advantage of it. It's not like we can't call functions like that because they're first class objects while in Java they aren't. JavaScript classes are different, so what?

Moreover, we're not done with syntax in JavaScript: more things are yet to come, and they'll be about classes too. Creation and composition of classes. This means things might change in the near future.

In conclusion, while I share the sentiment that, nowadays, in everyday coding in JavaScript you probably shouldn't define classes (except for React or similar), I refuse any dogmatic approach when it comes to getting things done. Let's keep an open mind about it.
MaxArt 2947 days ago. link 6 points
I thought we could have learnt something about how toxic saying "X is horrible/terrible/awful" could be. Things can be improved, but this disposition doesn't help at all.

Moreover, I don't feel EchoJS is the right place for linking a rant on GitHub issues. You can do that on a comment here instead: http://www.echojs.com/news/21298

Have a merry Christmas!
MaxArt 2949 days ago. link 2 points
It's ngrx/store, it's NOT Redux: similar but not the same thing.
MaxArt 2951 days ago. link 2 points
"Also, you don’t need any other tools to manage dependencies."

That's funny, it's also the main reason why Bower is being replaced by npm.

Even if you don't use a bundler, you can still load scripts from node_modules. If you don't like the folder name, you can use a symlink or switch to Yarn.

"Using Bower separates the front-end dependencies from the others"

Does it even still make sense? And why should I care? Where should I put Lodash, among front-end or back-end dependencies? There's a lot of isomorphic/universal JavaScript around, it's not like it's still Angular here and Express there.
And what if I *do* use a bundler for the front-end? Would I be stuck with debowerify?


No, I don't think Bower is still relevant at all. The only thing I liked is that you can state the type of module you're creating (AMD, ES6, CJS...), but that's pretty much all.

The publishing workflow is quite awkward and too tied to cloud Git hosts like GitHub. You also have to tag your releases. What if I don't want to, or if I use Mercurial, or I don't use *anything at all* - just my bare hard disk?

I've published some of my packages to Bower too - the ones that make sense on the front-end, anyway - the it always felt like a chore to me more than actually giving a solid contribution.
MaxArt 2951 days ago. link 1 point
Well, as I said, you don't have to *switch* - you can use them both, like you can do in Angular 2.

The odd thing is that we've been using "observables" since, like, forever. Of course not of the kind we have in RxJS, but we have events (the "observables") and listeners (the "subscribers"), and we lacked all the semantic syntax ofr transformation and manipulation such as map, forEach and so on. So, theoretically, it *shouldn't* be that hard to grok Observables.

But it kind of is, because of the mentioned sematic syntax which could be quite jarring from the usual procedural style.

But yes, Observables are somewhat needed. Maybe not in this form, but the concept behind them is necessary because, as I said, not everything could be achieved with a Promise.
MaxArt 2953 days ago. link 2 points
The proposal is interesting, but:

* while a scientific article can be ojectively verified in its experiments, bibliography and whatever material, how can you do that for JavaScript libraries?
* scientific peer review is an activity performed among universities, but there's no "JavaScript university" or anything with similar authority;
* who's going to actually pay the reviewers? And how? Will we expect their efforts to be like OSS?
* who's going to review the work of reviewers? Who's going to decide who can be a reviewer?
* who, and how, are going to write down a code of conduct for reviewers?

And so on. Not to mention that peer review in the scientific community can suffer of one or more of the following problems:

* absence of a second opinion;
* impracticability of appealing a rejection;
* university feuds;
* nationalistic pressure (!);
* inability to get in from outside the academic community.

Don't mistake me, it's still the best thing we have. But it has its flaws.
MaxArt 2953 days ago. link 1 point
It's not like one excludes the other, as they have different purposes. Promises are good for one-time events, while observables are meant for streams of events. It becomes problematic when we try to bend one to do the job of the other.

For example, right now we have a nice `fetch` API that *seems* to be perfect for promises (we've been using them since jQuery implemented `done` and `fail`), but now we've not only lost the ability to cancel a request, but also to watch for the progress in uploading the request and downloading the response.

You wouldn't use a Promise to listen to a click event, either.

Conversely, using observables for simple tasks (for example, getting a Blob out of a <canvas>) introduces unnecessary syntactic clutter.

The problem now is that we have native Promises, but still no native Observables.
MaxArt 2953 days ago. link 4 points
Sad news, but cancelable promises have always been on a problematic path. To be honest, the whole "promise" thing, while having some undeniable advantages, has some quirks that prevent a really good coding experience.

The inability to cancel a promise with a meaningful outcome is one of those things. We adopted promises and build a whole new syntax (async/await) around it, without thinking about future developments.

The fact is that promises are meant to be a simple tool to organize our code flow, and yet under - and even over - the hood they're not.

We'll have to wait for Observables to solve out control flow problems (hopefully). They're not simple, but at least they don't pretend to be.

Anyway, thank you Domenic Denicola for your effort. I don't think it's been in vain, for the whole community.
MaxArt 2957 days ago. link 1 point
I'll tell you what: we still have to wait several months to use it reliably, because it's only available in TP. Because Safari still has an old-school update cycle, when even Microsoft has learnt the lesson.
MaxArt 2959 days ago. link 1 point
Well, a bit, yes. Sometimes you get thrown off by some mistake that in the best case makes you stutter and distracts you, and in the worst it makes you misunderstand the meaning. As chris-l pointed out, the title itself suffers from this problem, as it sounds like you think *closures* are wrong!

I bet that's why you got 4 downvotes here, even though your article has good points.

As a non-native English speaker myself - and coming from a Romance language, too - I understand the difficulties of being fluent in English, as that's something that could be achieved with a lot of practice. Just like any other language, after all.

You write in English to make your content accessible to an international public, so it's better to get some proofreading help until you're confident to do that on your own.
[more]