Re: Mason 2.0 thoughts

Hans Dieter Pearcey <[email protected]> Tue, 15 May 2007 20:08:09 -0400
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On Sun, May 13, 2007 at 02:41:22PM -0700, Jonathan Swartz wrote:
> And both of these also suffer from being line based, and thus ill- 
> suited to handle small pieces of content, unlike CWC and Rails blocks  
> and TT filters.

I think this is a bit of a red herring.  All the examples given here and all
the examples on the rails caching doc page you gave are full lines of content,
also.  Given that caching tends to take several arguments (key and expiration,
at least), and that people tend to avoid very long lines, do you really think
that "it's line-based" is a huge hindrance?

<&| cache expires_in => '5m', key => $obj->cache_key &>some content here</&>

You're not getting very much on a regulation-width 80-column line.  The biggest
argument I can see for it is where the content is pretty much the output of
some mason-unaware function call. I'd probably still end up breaking it up just
so that the content stood out clearly from the caching directives.

If you want to steal from TT filters, what about something like

<% generate_content | cache(expires_in => '5m', key => $key) %> ?

There's definitely some kind of conjunction between filters and escapes and
CWC, but I'm still only groping towards it. :\

I'll be at YAPC and would totally enjoy having a conversation about this then,
if anyone else is up for it.

hdp.

-------------------------------------------------------------------------
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/