[jifty-devel] Re: [Jifty-commit] r2305 - Template-Declare/lib/Template/Declare

Audrey Tang audreyt at audreyt.org
Wed Dec 6 11:45:38 EST 2006


在 Dec 7, 2006 12:37 AM 時,Jesse Vincent 寫到:
> On Thu, Dec 07, 2006 at 12:27:59AM +0800, Audrey Tang wrote:
>> Next question: If I can make this work, would you be happy to see it
>> happen?
>>
>>     div {
>>           attr { id => 'foo' }
>>           p { 'some text -- semicolon is optional after the closing
>> brace!' }
>>           p { 'some more text...' }
>>     }
>
> If it's predictable, yes, that would be lovely.

I think it is.  That is, we can sequence side effects just fine:

     my $x = 0;
     div { p { $x++ } p { $x++ } p { $x++ } }

will still output 0/1/2, not 2/1/0.

The trick here is (again) context-driven katamari: Under scalar  
context the block is suspended without
actually executing, and the statement-level void context tag takes  
care of executing the pending sequence
in order.  If you're up for coding it tonight it'd be cool, otherwise  
I'll do it over the weekend.

Thanks,
Audrey


More information about the jifty-devel mailing list