On 08/09/2014 02:51 AM, sri wrote:
Bringing this up on the mailing-list in this early stage is a bit unusual,
but the core team is currently divided on this feature. So maybe some
feedback from the community would help us decide about its future.

     https://github.com/kraih/mojo/compare/nested_helpers

This branch contains a proposal for nested helpers, the idea is to allow
you to organize your helpers into different namespaces.

   helper 'foo.bar' => sub {...};

The dot serves as namespace separator, and "foo" becomes a helper that
returns a proxy object on which you can call all the nested helpers.

   $c->foo->bar(...)

These nested helpers work exactly like normal helpers with the only
limitation that they will not be imported into templates, since begin/end
blocks wouldn't work with them, but they can be called like <%=
$c->foo->bar %>.

What do you think?

Yes please.

I have a few projects going where helpers from plugins and the main app are clashing, and it got solved by having some very strict naming guidelines, but it makes things a bit messy. I'd much rather be able to have a plugin register it's helpers under a namespace (or in the 'main' app space) to keep things clear and have an easier time. It also makes more sense from a code perspective (IMO) to see '$c->auth->is_authenticated' than seeing '$c->is_authenticated' because it sort of indicates to readers of the code that it's not a native controller method.

If it's not too much of a pain in the you-know-what to implement I don't see a problem there. Having the option to do this is great, and if people don't want to use it that's up to them :D

--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to