1. 5

  2. 2

    Interesting read, but it makes me wonder: why does Moon exist rather than simply improving Vue? Is there enough fundamental differences to merit an either/or? This is coming from someone who has read about Moon, but uses Vue quite a lot in production.

    1. 5

      I get this question a lot. There are a lot of fundamental differences between Moon and Vue that would require a lot of breaking changes to Vue. The Vue compiler works in a completely different way from the Moon compiler (the differences are shown in the article).

      Also, Moon uses .set rather than getters/setters, which would also require a breaking change in how observers work in Vue. If you compare the source of Moon and Vue, you’ll see that they are completely different implementations.

      They are so different that it would essentially be rewriting Vue itself, and would have little chances of actually being merged into Vue. Check out my article Introducing Moon for more on why I made it.

    2. 1

      I tried MoonJS just for kicks in one of my recent projects (http://invatar.ga shameless plug). Too set context I have heavily used React.js, Vue, Angular 2+, Dio.js and even written one of myself (never published it though). Among other issues the one thing that disturbed/frustrated me most and stood out in my face was they way it forced me to invoke methods on this in a component this.callMethod('bar', ...params). I mean having getter setters ya sure makes sense; you can’t detect changes (which I don’t agree with; you can use getters/setters) or something. But why would you ever abstract out methods like that. Put it in a subspace this.methods.bar(...params). In today’s modern JS age people are more unforgiving and they have more choices; with these kind of caveats it’s not only hard for me to use moon but it’s even harder to convince my team members to use it.

      1. 1

        Hey! I appreciate the feedback. I agree with the points about this.callMethod, and have addressed them in v1. You will be able to do something like:


        Rather than callMethod. The main reason that it even existed in the first place was because it had to change the context of the method so that this would point to the instance.