As recently announced, we started to work on Hanami 2.x series.
We’ll rewrite hanami (the gem) to simplify the internals, as they accumulated years of legacy code, since the old days of Lotus.
That means we’ll incrementally build and ship all the features, like we’re starting the project from scratch. This first release will only support the new version of hanami-router and hanami-controller without including views, assets, helpers, models…
Here’s the complete list of features for this release:
CLI as it is
New version of hanami-router and hanami-controller (no views, assets, helpers, models)
Generate base action/view for each app (apps/web/action.rbWeb::Action < Hanami::Action; endWeb::Controllers::Home::Index < Web::Action; end) https://trello.com/c/RNO8zqex
Looking back through the ideas thread specifically (Hanami 2.0 Ideas) and the first alpha and what’s listed here, plus the code, and the sort of cryptic log on https://trello.com/c/lV4KEFRy and I’m wondering if a decision was made to ditch the Roda-backed router from 2.0.0 that I may have missed. If not, I’d love to know where to look / how to help on getting the work needed done for the next alpha in April.
@jimcavoli The idea to not use roda as router backend is the result of frustrating code sessions where I tried to hook into roda. The block syntax was really hard to bend to hanami-router syntax. Even for a simple use case, I ended up with hacks to make it to work. From there the decision to build the internal engine my own. Is the absence of roda a stopper for you?
No, not strictly speaking; that would seem like an overreaction to me. I may take a deeper look at the internals of Roda as they might be able to be applied to hanami-router. I understand the desire to protect syntax as a feature, and frankly, Mustermann is easily the best option in this regard for flexibility. Can’t fault that as a choice from the framework perspective, though I think I’ll sit around for a while thinking about what reasonable things might be doable to provide a further speed boost since routing is typically the biggest headache for actually getting things returned quickly. If I can come up with anything useful, I’d be happy to bring back a proposal. Thanks for the reply and clarifying!
@jodosha Frankly either, depending on what looks easier, but most likely to try and put routing tree processing on top of Mustermann since that would likely be easiest. I’m diagramming out a few ideas presently, but I think that trying to find a way to speed Mustermann’s routing decisions would probably be the simplest and possibly most transparent to this project and stands to have some carry-on benefit to others. If there’s a preference between solutions, I’m happy to direct more energy one way or another.
The main problem with chasing a Roda or Roda-inspired approach would seem to be that it leverages a control-flow short-circuiting approach with blocks. While incredibly fast, is equally incredibly difficult if not impossible, as you’ve discovered, to cleanly/sanely implement on the back of the rails-like routing DSL currently used by hanami-router. It’s far easier to continue to maintain Mustermann patterns for matching against, so my thought is that changing the route lookup to use a more optimized search than Enumerable#find as currently implemented may be able to split the difference and get a reasonable speed boost in while not sacrificing syntax. This could take lots of forms, including using and/or further improving Mustermann::PatternCache, building a more optimized search tree approach above Mustermann in hanami-router, or probably a number of other things, but those are the leading two ideas I’m down to after the first two hours of thinking about it.
To clarify: my tree experiments have low priority, given there are other pieces to put together (e.g. new hanami-view). I’ll be more than happy to have a look at your implementation and give hanami-router a boost! Thanks!
Hi @jodosha. Looking forward to this release. Is January 2019 still the expected time frame for this release, or is there a later date we predict now? Thank you for all your hard work, best wishes