|Pathologically Eclectic Rubbish Lister|
Is Devel::Declare really so much less evil than source filters?by moritz (Cardinal)
|on Apr 05, 2010 at 13:26 UTC||Need Help??|
moritz has asked for the
wisdom of the Perl Monks concerning the following question:
Recently there has been quite a hype about syntax extensions to Perl that don't work via traditional source filters, but through Devel::Declare.
Lots of people who wouldn't touch source filters now write such syntax extensions like MooseX::Declare, and they seem to be well accepted.
However I still have some measure of reserve towards them, which I'd like to discuss with you. There are basically two reasons why source filters are wildly considered very evil™:
Now I read that Devel::Declare only hooks on barewords, and use the built-in parser for the rest.
But still the syntax changing module has to parse something. For example MooseX:::Method::Signature allows things like:
It is my hope that the where-block allows arbitrary Perl code. Is that true? And if so, is the "real" Perl parser used for parsing it? And if yes, can other syntax changes based on Devel::Declare be used in this block?
If the answer to all three questions above is "yes", then I'm happy to acknowledge that Devel::Declare is really a good thing, and worth using (and actually comes quite close to "real" macros, except in scope of what can be changed).
If not, I'd argue that D::D based syntax changes are only gradually less evil than source filters, not conceptionally less evil.
What do you think? Does anybody have experience if D::D based syntax changes are really robust?
Great module for try/catch sugar in perl. I love pairing it with Moose::Util::TypeConstraints to have type based exception handling. Make sure that you have the latest Devel::Declare or you can have some weird issues that won't seem to make any sense.
The last sentence seems to suggest that it's not robust, or at least it was not. Still the question remains if it's a conceptional fault, or merely a lacking implementation right now.
Perl 6 - links to (nearly) everything that is Perl 6.