Road to v3.0.0 #2754
Replies: 15 comments 38 replies
-
@StephanHoyer that sounds excellent! I ❤️ all your point items. What do you have in mind to rework the router? I am particularly interested in this. Thank you for your efforts! |
Beta Was this translation helpful? Give feedback.
-
@StephanHoyer sounds good... If we're eliminating POJOs, can we eliminate |
Beta Was this translation helpful? Give feedback.
-
I read the issue about replacing All the rest sounds cool! |
Beta Was this translation helpful? Give feedback.
-
Just echoing @webketje - I feel like v3 should (similar to v2) not introduce or alter too many APIs. But just remove API's to make it clearer what the community thinks is idiomatic. E.g. removing classes/pojos/oninit. I'm ok with removing stream (even though I wish we'd actually lean into streams more ). But having it as a separate module that is so similar to flyd sort of defeats the point of having it at all. I think the router can be cleaned up, but if we took @foxdonut's approach and just exposed primitives, we could keep the current router API there for v3 and let people use the low level primitives with custom routers for e.g. meiosis. And then just improving the release process and the docs, moving to esm as source, removing the bundler etc, all of that can be still v2.x There hasn't been much complaints or demands to change the lifecycle, but there has been frequent confusion in gitter from people reaching for classes/oninit/pojos, followed shortly after by @CreaturesInUnitards saying to use a closure, so we should just have a release that makes it harder for newcomers to get confused, by removing options. Removing things is enough of a breaking change for one major release I think. New API's should probably come in a separate pass and driven by community needs/requirements. I think most of us are pretty happy with the core of v2's API as it is. |
Beta Was this translation helpful? Give feedback.
-
FWIW I'm in favor of all points (eventually), including removing |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@StephanHoyer All you'd need to do here is |
Beta Was this translation helpful? Give feedback.
-
What is your opinion about integrating something like classies into the core. I think we did this discussion a few times, but I would really like to see this integrated. m('div', { classes: { foo: true, bar: false } }) //=> <div class="foo" /> Alternative attribute name can be |
Beta Was this translation helpful? Give feedback.
-
Am I the only one the uses oninit? I use it all the time - esp with POJOS which I use when that component does not need to have its own state.
am i correct in that removing POJOS and oninit would require me to write components like this?
I have never used vnode.state - so I dont have an opinion on that - unless removing it will reduce size or improve perf and then I will be up for it. |
Beta Was this translation helpful? Give feedback.
-
Add me as a +1 on keeping the API breakage minimal. My very small voice notes that I use Mithril for two reasons:
I understand that many people might dislike classes in js and therefore class components but I am a definite fan. For that matter, for very simple components, I love POJO components. |
Beta Was this translation helpful? Give feedback.
-
Hello to everyone, Does anyone has an idea of when the v3 might be released? I see no commit in the last 6 month - and very little activity overall - hinting that progress is not being done. As such, I'm a little concerned about the state of Mithril. I know we should not fix something that is not broken, but after some point it starts looking like an abandonware, making it extremely difficult to convince people to use Mithril for anything work related. Other than that, thanks a lot for Mithril! Been using it for the past 5 years and I love it ! |
Beta Was this translation helpful? Give feedback.
-
I've been out since the summer because of health issues (likely a post-COVID syndrome). I'm at long last getting back some ability to focus and can once again contribute here. #2273 or something similar is material for the next 2.x release. I can give it a crack this month (starting this week). |
Beta Was this translation helpful? Give feedback.
-
Hey all I used Mithril v2 a couple of years ago and loved it but had to let it go because I needed a better full stack solution. Mithril is great client-side but the server-side rendering is quite slow. I did these benchmarks a couple of months ago:
https://github.com/PierBover/fastify-vite-ssr-benchmarks Just something to consider if you're thinking about improvements for v3. |
Beta Was this translation helpful? Give feedback.
-
Hi! First of all, I'm a big fan of Mithril. Thank you so much for creating and maintaining this fantastic framework! Just my 2c on one of the proposed changes: I'm a fan of ES6 classes, and would be disappointed to see class components removed as an option in v3. My reasoning is as follows. 1. OptionalityI like traditional OO, and coming to Mithril from that background felt like a lower barrier to entry for me. That's subjective, I know. But the fact that Mithril gave me the option to use classes is arguably a point in the framework's favour. 2. Performance concernsI know that in a great many scenarios, this is not going to matter; but in some scenarios, it might. On my understanding, putting functions, e.g. As detailed here, this can have an impact on both processing speed and memory consumption: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures#performance_considerations. It seems that part of Mithril's appeal compared to other frameworks, is that it's very fast and has a low footprint. Offering a class-based API, at least as an option, seems consistent with that value proposition, to me. In summary, I feel it's a good thing that Mithril offers users the option of using classes, whether for those who prefer them stylistically, or for performance optimization. |
Beta Was this translation helpful? Give feedback.
-
PerformanceI'm disappointed in MDN for that performance advice, its true in the strictest sense, but with any advice regarding performance, its important to benchmark and take a holistic and contextual approach. E.g. in VDOM we're creating thousands of objects every redraw. Closures memory use is very much in the noise. So in the context of view frameworks lets look at the landscape: In React, they not only destroy and recreate the vdom, but they also allocate hook functions every render too. Mithril closures are comparatively a lot more memory efficient as you can declare reusable state and utilities one time per component instantiation (instead of every render). In Solid.js, signal computations re-evaluate their dependency tree from scratch every propagation. (This is how signals have "auto cleanup" they throw away the previous dependency information and closure every propagation). And yet signals are lauded for their performance. A core contributor to the mithril community is working on their own framework, and it is very similar to mithril but reportedly also much faster, and it has no class components. Closures are a part of life in JS, and if we're going to optimize memory churn the last place we'd look is closure components when we're constantly thrashing the GC with the VDOM (which is still super fast). That's not to say classes don't have their place, I use them sometimes in library code for the exact reason you state, but never in application code. SupportAlso including class components somewhat implies mithril supports and encourages all the other patterns that classes support, e.g. inheritance. But component inheritance is commonly seen as an anti pattern. So if we support classes and people in the chat ask questions that boil down to the fragile base class problem and we say "well we recommend you use closure components", the natural response will be, "why do you have classes if you don't recommend using them?" - which is a very good question. In my experience (answering questions on the gitter and zulip for many years now) classes lead to more bugs and confusion. When you use closures, there's no dynamic this context to contend with, you are just referencing things that are already in scope. This is simpler, but also can be faster because there's less machinery involved in a closure component. You often can do more with less. AdoptionMithril could do a lot of things to get more adoption. But if one of those things is retaining a programming pattern that the core team seems to agree is a footgun, then we're not being very responsible. If other people want to use classes and pick another framework that is okay. Mithril will strive for simplicity above all else, and classes are very complicated (both their usage and their ever expanding specification). Closures are extremely simple, a function that returns a function. But I'd question if this is generally true, I see most frameworks moving away from classes, probably for similar reasons to what I've already stated, they lead to bugs and the case for performance isn't very strong. Backwards compatibilityIts not hard to author a component as a class but then have a small util that wraps your class and converts it into a pojo or closure component interface. E.g. function component(ClassComponent){
return function Wrapper(vnode){
let instance = new ClassComponent(vnode)
return instance
}
}
class MyComponent {
...
}
export default component(MyComponent) So if you really do prefer that interface and are happy to contend with |
Beta Was this translation helpful? Give feedback.
-
Hi all,
as we are working through the last issues before releasing 2.1.0 hopefully this month we should think about whats next with mithril.js. There are a few things I personally want to tackle, most of it is replace NIH-solutions with established solutions to reduce maintenance of the project and let us focus on bringing the framework itself forward. That includes
ospec
to own repo (or even discontinue it, except anyone wants to takeover maintenance 🤷♀️)stream
to own repo (or even discontinue it, except anyone wants to takeover maintenance 🤷♀️)A second big thing we need to do is to modernise the documentation, both from the technical standpoint and also the aesthetics.
We also plan to change a few internals. I don't have all in my mind right now, we can start the discussion on a few of them right now. What comes in mind are
retain
Most of the things are great ideas from @dead-claudia.
So this discussion is the place, where we can start discussing all this. I'm really interested about your opinions and wishes for the future of this great little framework.
Beta Was this translation helpful? Give feedback.
All reactions