VirtualCSS / planning

Repository for planing and brainstorming on the VirtualCSS system
MIT License
66 stars 0 forks source link

WIP on the first idea #4

Open jviereck opened 9 years ago

jviereck commented 9 years ago

Just pushed a few more changes. These changes move the code further away from react-style. I tried to come up with a good way to solve the problem of extending existing styles like in

<Button styles={[ButtonStyles.error, ApplicationStyles.childStyle]}>

and ended up introducing what I call "composer" functions, such that the above becomes now:

<Button styleDef={ButtonStyles.error(ApplicationStyles.childStyle)]}>

The points 3) onwards in the README.md should hopefully give you and idea about the changes and the last point 7) covers the idea behind the composer functions.

The idea about composer functions is highly inspired by the blog post Mixins Are Dead. Long Live Composition, which talks about the trend in React to move away from mixins and towards composition, and the linearization concept in type systems like Scala. In fact, many of the latest changes came to my mind when thinking about extending CSS classes as a problem in other object oriented programming languages.

As always, if you have any questions or want me to explain details in more depth, please let me know.


Do you think the idea about the "composer functions" is too far fetched or do you think they actually make sense? I personally like the idea very much but I am not sure if my love for type systems makes me biased here.

jviereck commented 9 years ago

As always, if you have any questions or want me to explain details in more depth, please let me know.

Aka, if you want, I am happy to write up more about the composer idea and turn it into a blog post :)

jviereck commented 9 years ago

Two small changes that I've just pushed: