[jifty-devel] some progress update about Template::Declare

Ruslan Zakirov ruslan.zakirov at gmail.com
Wed Jan 7 09:36:35 EST 2009


On Wed, Jan 7, 2009 at 3:18 PM, Kang-min Liu <gugod at gugod.org> wrote:
> ruz:
> imho, the new syntax is easier to read. And it actually renders faster in
> runtime. Of course it's just shift some jobs to compile time like all those
> Devel::Declare based modules. Moose.
> I've done a very simple benchmark program a few weeks ago:
>     http://gist.github.com/37042

impressive and this difference comes from?

> By that time Markapl had only very limited features but the result of
> benchmarking shows that Markapl is somewhere about 200% faster then TD. I
> wish it'll still be that much faster when Markapl becomes almost as feature
> rich as TD.

Looked briefly inside, see no html escaping... Also, don't understand
how chaining is implemented, for example "p {'x'} p {'y'}".

> However, I don't know what "problem" does it really solve for TD, actually.
> Maybe not, since TD is like super solid for a long time. It's more like a
> matter of preference. I prefer this syntax  much more from the moment that I
> saw TD and I couldn't change it to the way I want until now that I've learn
> to play with Devel::Declare.

TD has some pitfalls. Different syntax for the same purpose is one of them.

>
> As for the concern of maintability, by what I've got in the current work
> progress of integrating Markapl into TD, I'd say there're probably some
> decision to make to drop some backward compatibility at some point. Not now,
> nor it's coming soon, but having to support all sorts of syntaxes to assign
> attribute values make the code look horrible.

That's my point too, few weeks ago found code where I wrote "div {
attr { x is 'x' } }"

I like more "attr {...}" inside a tag these days as you can make
calculations and also all the data related to a tag stays inside its
block.

18 dec 2008 I made a talk for local PM group -
http://moscow.pm.org/talks/10/declarative_syntax.pdf. It's in Russian,
however examples (http://moscow.pm.org/talks/10/dsl_examples.tar.gz)
may be interesting. It's a talk on implementing TD from scratch,
however I've used different buffering concept that can be interesting
for adoption.


> On Wed, Jan 7, 2009 at 6:56 PM, Ruslan Zakirov <ruslan.zakirov at gmail.com>
> wrote:
>>
>> New syntax. I'm afraid such step could lower maintability. What the
>> point? What will it give? Which problems it solves?
>>
>> On Sat, Dec 27, 2008 at 2:55 AM, Kang-min Liu <gugod at gugod.org> wrote:
>> > Hi, all
>> >
>> > Recently I've been trying to use Devel::Declare to re-implement
>> > Template::Declare for this very fancy syntax:
>> >
>> >     div(id => "salute") { "Hiya" }
>> >
>> > And it worked very fine, big success. I'm very impressed by how much
>> > it can be done with
>> > Devel::Declare and B::Hook* modules. Kudos to rafl++
>> >
>> > I released the implementation under the name "Markapl" (Mark up as
>> > Perl) on CPAN few days ago.
>> > The Markapl repository is on Github:
>> >  http://github.com/gugod/markapl/tree/master
>> >
>> > And since obra requested, I'm currently integrating it into
>> > Template::Declare. Several basic parts are
>> > all ported, so statement like these are all working now:
>> >
>> >     div(id => "salute") { "Hiya" }
>> >     div("#salute") { "Hiya" }
>> >     div(".salute") { "Hiya" }
>> >     div("#salute.box") { "Hiya" }
>> >
>> > And it's still backward compatible:
>> >
>> >     with(id => "salute"), div { "Hiya" }
>> >     div { attr { id => "salute"} outs "Hiya" }
>> >
>> > The development is on "markapl-syntax" branch of Template-Declare
>> > repository, the new code passes
>> > about 60% of tests now. So please take a look, give me some thoughts
>> > and may patches. It's all welcome. :)
>> >
>> > btw, I've just done a tool Markpl::FromHTML (on CPAN now) that
>> > currently convert
>> > simple HTML to Markapl. This can be a pretty handy tool when working
>> > with HTML-capable visual designers. :)
>> >
>> > Cheers,
>> > Kang-min Liu
>> >
>> > _______________________________________________
>> > jifty-devel mailing list
>> > jifty-devel at lists.jifty.org
>> > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
>> >
>>
>>
>>
>> --
>> Best regards, Ruslan.
>> _______________________________________________
>> jifty-devel mailing list
>> jifty-devel at lists.jifty.org
>> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
>
>
>
> --
> Cheers,
> Kang-min Liu
>
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
>
>



-- 
Best regards, Ruslan.


More information about the jifty-devel mailing list