Perrin Harkins writes:
> The advantage is that my example can contain other templating code:
> 
> [% FILTER font('basic_info_font') %]
>    Hello [% User.first_name %]!<BR>
>    [% IF User.accounts %]
>       You have these accounts:<BR>
>       [% FOREACH User.accounts %]
>         [% name %]: [% balance %]<BR>
>       [% END %]
>    [% END %]
> [% END %]
> 
> Unless I'm missing something about your example, the FILTER concept 
> seems more powerful.

[Skirting on the edge of YATW. :-]

I think they are equivalent as far as "power".  I go back to why
people use Perl, because it makes the easy jobs easy and the hard jobs
possible.  All programming languages are Turing Complete, but we don't
like programming Turing Machines.

Here's your expanded example in widgets:

    String(Prose(<<'EOF'), 'basic_info_font');
    Hello String(['Model.User', 'first_name']);!<br>
    If(['Model.AccountList', '->get_result_set_size'],
        Join([
            "You have these accounts:<br>",
            Table('Model.AccountList', [
                'name',
                'balance',
            ]),
        ]),
    );
    EOF

The Table widget will print a table with headings defined by the
Facade (our term for skin).  The widgets for name and balance are
looked up dynamically.  balance will be right adjusted.  Unless I
missing something, the template example won't align properly in HTML.
This is a significant semantic difference between FOREACH and
Table.

Would you expand on the example so that name and balance are columnar?

Rob


Reply via email to