How much DSL is too much?

10 views
Skip to first unread message

Sebastian Riedel

unread,
Jun 25, 2011, 9:27:59 AM6/25/11
to mojol...@googlegroups.com
I've built a little proof of concept plugin for making helpers part of the Mojolicious::Lite DSL and would really like to hear what you think about the idea.

https://gist.github.com/1046452

Personally i'm a little worried that it could get in the way of growing lite apps into normal ones, since more code modifications would be required.
But that would mostly be a documentation problem and it could just as well lower the learning curve for getting started.

--
Sebastian Riedel
http://mojolicio.us
http://twitter.com/kraih
http://blog.kraih.com


sri

unread,
Jun 25, 2011, 1:41:54 PM6/25/11
to Mojolicious
And here are two hello world examples comparing both forms, which one
do you prefer?

https://gist.github.com/1046696

--
sebastian

sri

unread,
Jun 26, 2011, 10:54:49 AM6/26/11
to Mojolicious
Here's a bigger example for both styles.

http://pastie.org/2124820
http://pastie.org/2124828

I do have a working patch now and it does not break any existing apps,
but i'm still undecided if more Mojolicious::Lite keywords are really
a good idea.
At the moment i actually tend towards sticking with the old style,
since it feels more consistent and less magical.

--
sebastian

Viliam Pucik

unread,
Jun 26, 2011, 1:45:44 PM6/26/11
to mojol...@googlegroups.com
Be or not to be? :)

Just thinking out loud:

use Mojolicious::Lite; # the good old way as we all know it
use Mojolicious::Lite 'magic'; # enables the "evil" DSL plugin

And let's see what people will like/use more.

> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To post to this group, send email to mojol...@googlegroups.com.
> To unsubscribe from this group, send email to
> mojolicious...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mojolicious?hl=en.
>
>

Roland Lammel

unread,
Jun 26, 2011, 2:09:50 PM6/26/11
to mojol...@googlegroups.com
I really think that this is a little too much DSL, as it will not draw a clear border where DSL is used and where not. Common functionality like modifying headers, doing a little error processing or conditional handling, will still require one to have $self around. So it might make it less clear in the end for the novice.

I really think that the $self issue is something that perl5 should solve internally (like providing the a method keyword that will have a $self set by default (we something similar in the Devel::Declare based thingies around, but that still is voodoo-magic and nothing in perl5 core).

Cheers

+rl

"Enjoy your job, make lots of money, work within the law. Choose any two."



--
sebastian

sri

unread,
Jun 27, 2011, 2:08:31 AM6/27/11
to Mojolicious
The consensus here and on irc seems to be that it's too much magic.

--
sebastian
Reply all
Reply to author
Forward
0 new messages