Checkout these modules: Test::Class::Sugar MooseX::Declare
Thank you for your feedback.
Checkout these modules: Test::Class::Sugar MooseX::Declare
Thank you for your feedback.
Python has rich meta-programming. Ruby has (almost) single-handedly super-hyped and re-invented the idea of domain specific languages (DSLs). Lisp is of course all about this (as is Forth).
Javascript builds on the ideas from Smalltalk and (especially) Self to allow you to crazy stuff with how objects work...
Java can't do much of this, but the JVM has been bent in surprising ways by efforts like Clojure and Scala...
While it is great that you know and like perl -- That particular point in the post (and this comment) seems rather poorly researched.
I'm very much on the burnt-by-crazy-old-nasty-perl-legacy-crap side of the fence -- but I can't deny that I see some of the reasons why people would like to use perl -- it's just not for me. The statement "Perl evolves in a ... manner that makes the language always fresh" makes me want to hide under the bed -- if I have to deal with someone else's code in production ;-)
Still -- it's a bit strange to see the claim that perl is somehow much more flexible than other comparable languages.
At that time there were already quite a lot of movement within eg: python with improvements being made to the language, in the language itself.
So, yes, I guess I'm sticking to my guns.
I am very familiar with all of the languages that you mention. They are all great languages in their own right. My comment however was about Perl's ability to easily evolve the core language via contributions from its community, as opposed to other languages that require a lenghty process performed by the core maintainers of the language. This allows Perl to evolve at a much faster pace than other languages. A lot of your points do not seem relevant in that context.
"Python has rich meta-programming."
Who cares? So do most modern languages.
"Ruby has (almost) single-handedly super-hyped and re-invented the idea of domain specific languages (DSLs)."
The Perl community has been writing DSL's since before most people had heard of Ruby. Real DSL's. Not just invoking functions without parens and labeling it a DSL, as is often done in the Ruby community. Ruby in no way invented or re-invented anything having to do with DSL's.
"Lisp is of course all about this (as is Forth)."
Agreed. Lisp macros are very powerful. Lisp is a great example of a language that can do this.
"I'm very much on the burnt-by-crazy-old-nasty-perl-legacy-crap side of the fence -- but I can't deny that I see some of the reasons why people would like to use perl -- it's just not for me."
This is a common complaint. People have had to deal with Perl code that they do not understand. It may have been poorly written, or it may have been perfectly written Perl code. If you do not take the time to learn Perl, you would not know the difference. The most common reaction is to blame the language.
"Still -- it's a bit strange to see the claim that perl is somehow much more flexible than other comparable languages."
It may be strange to you because you are not very familiar with Perl.
The problem is that Perl's TIMTOWDI culture and the inconsistent evolution of the core language make learning "enough" Perl harder than learning e.g. "enough" Python.
Perl has a very rich and powerful and expressive grammar. It takes a good bit of effort to learn all of it. Python has opted for a grammer that is much more simple. That definitely has its benefits. For me personally, I feel constrained when writing Python code due to its lack of expressiveness.
I'm perfectly aware this is a subjective opinion: I don't like perl very much. I never claimed everyone else should dislike perl -- in fact I stated the opposite -- I see why it appeals to some people.
> My comment however was about Perl's ability to easily evolve the core language via contributions from its community, as opposed to other languages that require a lenghty process performed by the core maintainers of the language.
> "Python has rich meta-programming." >> Who cares? So do most modern languages.
Well, your claim is that perl has strong meta programming, and that perl programmers use it -- implying that eg: python programmers choose not to, and rather sit on their hands waiting for Guido to bless their new data structure or syntactic sugar for improving arrays?
See eg: http://www.python.org/dev/peps/pep-0218/
I suppose this your "lengthy process" ? But the set module was available before it became part of the core language, so if you were the programmer that needed a new datatype nothing stopped you from implementing it and uploading it to the package index? (Although I don't remember quite how well the package index worked back in 2000 -- CPAN certainly has a long and solid history behind it :-)
For another example (again python):
http://kashif.razzaqui.com/30414548 "Javascript's Prototype Inheritance in Python"
As for ruby, note I said "super-hyped". Maybe I should've said "re-introduced", or "introduced to a new generation of programmers", rather than "re-invented".
> It may be strange to you because you are not very familiar with Perl.
Perhaps. I would be very much interested in some examples of the DSLs you speak of. I guess perls regex-handling would lend itself to be used as a poor man's Standard MetaLanguage?
http://www.catalyzed.org/2009/05/dawn-of-a-new-age-in-perl-h...
Now, while power obviously is power -- I don't see many immediate uses for that, that can't be done better within in python via magic methods etc.
But in case others are interested, here's a couple of links I also came across:
http://stackoverflow.com/questions/214881/can-you-add-new-st...
http://eli.thegreenplace.net/2010/06/30/python-internals-add... (Most definitely in the "don't do that"-category from a python point of view :)
If this (writing a new language) is really what you want, you would probably be better off playing with pypy and its restricted python, though:
https://bitbucket.org/brownan/pypy-tutorial/src/8cfb3cd72515... (Tutorial for writing your own interpreter with rpython)
https://bitbucket.org/cfbolz/pyrolog/src/aa127d31df0c/prolog... Working implementation of Prolog, built with pypy/rpython
I don't think you have been paying attention to what I have been saying. You keep mentioning that python has strong meta-programming. I never said anything about meta-programming. Perl, python, ruby, everybody can do meta-programming. I said that Perl lets you easily modify the core language grammar via 3rd party modules. This is an extremely powerful feature, if you took a second to think about it.
However, if someone wants to do something similar in Python, here are how you would (have) to do it. I didn't mean to say that it was the same - or as straightforward.
This is also why I linked to the r(estricted)python examples with pypy -- because they give you more of the power to define a whole language -- but that also isn't the same as being able to do it within the language itself.
As for meta-programming, I have always meant that in the sense of lisp macros, not simply chaining some cleverly named functions.
I'm still not convinced it's a feature I would want in Perl -- but then again, I don't particularly like Perl, and I don't use it -- so clearly what I think of it doesn't matter: I'm not the target audience for Perl features.
Thankfully we don't all prefer the same tools :-)
https://metacpan.org/module/MooseX::Declare https://metacpan.org/module/Test::Class::Sugar
Just look at the SYNOPSIS section for example code. If you know some Perl, you will notice that the code would normally not be valid syntax. Yet simply by using a module, you can define classes (MooseX::Declare) or describe tests (Test::Class::Sugar) in a brand new way.