Discussion:
[jifty-devel] some progress update about Template::Declare
Kang-min Liu
2008-12-26 23:55:35 UTC
Permalink
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
Ruslan Zakirov
2009-01-07 10:56:47 UTC
Permalink
New syntax. I'm afraid such step could lower maintability. What the
point? What will it give? Which problems it solves?
Post by Kang-min Liu
Hi, all
Recently I've been trying to use Devel::Declare to re-implement
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
div(id => "salute") { "Hiya" }
div("#salute") { "Hiya" }
div(".salute") { "Hiya" }
div("#salute.box") { "Hiya" }
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
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
--
Best regards, Ruslan.
Kang-min Liu
2009-01-07 12:18:09 UTC
Permalink
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

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.

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.

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.
Post by Ruslan Zakirov
New syntax. I'm afraid such step could lower maintability. What the
point? What will it give? Which problems it solves?
Post by Kang-min Liu
Hi, all
Recently I've been trying to use Devel::Declare to re-implement
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.
http://github.com/gugod/markapl/tree/master
Post by Kang-min Liu
And since obra requested, I'm currently integrating it into
Template::Declare. Several basic parts are
div(id => "salute") { "Hiya" }
div("#salute") { "Hiya" }
div(".salute") { "Hiya" }
div("#salute.box") { "Hiya" }
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
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
--
Best regards, Ruslan.
_______________________________________________
jifty-devel mailing list
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
--
Cheers,
Kang-min Liu
Ruslan Zakirov
2009-01-07 14:36:35 UTC
Permalink
Post by Kang-min Liu
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.
http://gist.github.com/37042
impressive and this difference comes from?
Post by Kang-min Liu
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'}".
Post by Kang-min Liu
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.
Post by Kang-min Liu
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.
Post by Kang-min Liu
Post by Ruslan Zakirov
New syntax. I'm afraid such step could lower maintability. What the
point? What will it give? Which problems it solves?
Post by Kang-min Liu
Hi, all
Recently I've been trying to use Devel::Declare to re-implement
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.
http://github.com/gugod/markapl/tree/master
And since obra requested, I'm currently integrating it into
Template::Declare. Several basic parts are
div(id => "salute") { "Hiya" }
div("#salute") { "Hiya" }
div(".salute") { "Hiya" }
div("#salute.box") { "Hiya" }
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
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
--
Best regards, Ruslan.
_______________________________________________
jifty-devel mailing list
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
--
Cheers,
Kang-min Liu
_______________________________________________
jifty-devel mailing list
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
--
Best regards, Ruslan.
Jesse Vincent
2009-01-07 16:41:41 UTC
Permalink
Post by Ruslan Zakirov
New syntax. I'm afraid such step could lower maintability. What the
point? What will it give? Which problems it solves?s
At least partially, it's the syntax I wanted since the very beginning.
I'd really like the with() syntax to die a horrible death.

Loading...