Re: Mason 2.0 thoughts
Dave Rolsky <[email protected]> Sun, 13 May 2007 17:45:50 -0500 (CDT)
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 13 May 2007, Jonathan Swartz wrote: >> I don't get why people think we'd need something new. This can be done >> as-is with the current Mason using the component-with-content feature. >> That's what I was suggesting in my original message. > > Sadly, I think components are the wrong place to put this kind of > functionality. > > I've never liked or used CWC very much, and I believe one of the reasons is > the same reason that Dave started putting form handling in subroutines (first > with MasonX::WebApp, then with Catalyst). Many potential blocks/tags/filters > - i.e. higher order functions that take a piece of Mason template as an > argument and process it in some way - will be all or mostly pure-Perl, and > thus cleaner to write with a subroutine or method than with a component. I totally agree. In my Mason 2.0 notes, I mentioned that I wanted to extend the CWC feature to allow calling a subroutine, something like how TT2 does filters. <&| caching_subroutine(), ... &> [content] </&> Which is a lot like TT: [% USE foo = Filter::Foo %] [% FILTER foo(...) %] some content [% END %] > So IMO it would be great to have a special syntax for these filters (or to > co-opt an existing syntax like <% %>), a syntax that was nestable, and not > line-based, and able to handle arbitrary Perl arguments. THe CWC syntax is exactly that syntax! > Given that, it is somewhat unfortunate IMO that we came up with CWC first, > because such a new syntax would be blamed for cluttering the Mason language > unnecessarily, whereas in retrospect I'd rather have a module-based filter > syntax than CWC. I think we're on basically the same page. I'm just saying that we can use the syntax we have, but extend it to allow calling subroutines, components, and "named" filters. Now, I don't know exactly how we'd distinguish all of them, but I like the idea. -dave /*=================================================== VegGuide.Org www.BookIRead.com Your guide to all that's veg. My book blog ===================================================*/ ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/