Code Monkey home page Code Monkey logo

Comments (3)

mitar avatar mitar commented on May 21, 2024

No, mixins in Blaze Components were designed to work well with ES6 and JavaScript. As described in the README:

JavaScript is a single-inheritance language and instead of Blaze Components trying to force fake multiple-inheritance onto a language, it offers a set of utility methods which allow the component to interact with its mixins and mixins with the component. The code becomes more verbose because of the use of methods instead of overloading, overriding or extending the existing elements of the language or objects, but we believe that results are easier to read, understand, and maintain.

We decide to simply use a system on top of what JavaScript provides, without any mingling of JavaScript internals. See the diagram in the README.

Also, it is an optional feature. You do not have to use mixins. You can vanilla JavaScript or ES6. If that is good enough for you, great. If not, Blaze Components offer a non-intrusive API to provide mixins for you. It is mostly there so that if community develops mixins that those mixins can interoperate, instead of each implementing some fake ways manually.

So mixins as they are in Blaze Components are "real in ES6". They work with ES6. Maybe they should be named something else, just to not confuse things when there will be official mixin support in ES2099. But what is here is now and working, and behaves as a mixin. If there will be some mixins in the future, they will be not conflicting with these mixins (except in the name).

Also, mixins are not the core reason this package exist. This package exist mostly to make UI in Meteor more reusable. If there will be other mixins available, then that will be just another way to provide more composability. And we can always then just make internal implementation of Blaze Components mixins use official mixins.

I also talked with Dave Herman about ES6 and mixins do not seem to be anywhere near. So I do not think we should worry about this now. And in meantime we can use these non-intrusive mixins. :-)

from meteor-blaze-components.

mitar avatar mitar commented on May 21, 2024

So mixins are offered now because nothing better exists. But you can decide not to use them and use only inheritance. I think that for UI composability is better, but we will see how things will go. This is the idea of the project. To create a community developing reusable components. And we will all learn what works and what does not. How you compose or inherit event handlers? How you compose or inherit animations? How you compose or inherit template content? Still many open questions. But at least now we have a space around which we can start trying things out.

from meteor-blaze-components.

mitar avatar mitar commented on May 21, 2024

(Closing as answered, but discussion can continue.)

from meteor-blaze-components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.