Linked by Thom Holwerda on Fri 10th Sep 2010 14:59 UTC
General Development Python programmers shouldn't get too smug. While many people agree that Python is designed in a way that makes it a highly readable language, there can still be problems with legacy, untested Python code too. Porting legacy Perl to Python can be a daunting task. In this article, learn some of the theory behind dealing with legacy code, including what not to do.
Thread beginning with comment 440395
To view parent comment, click here.
To read all comments associated with this story, please click here.
google_ninja
Member since:
2006-02-05

I would _highly_ recommend learning a language before making sweeping statements like this. You really make yourself look like a moron when most of what you say is just flat out wrong. (perl actually does almost all of those things). That being said, I sort of wanted to comment on this

Many of Perl's weaknesses as listed above can be fixed to at least a certain extent by downloading a bunch of CPAN modules that basically modify the language (see the perl5i CPAN module for a good example).


A powerful language is one that can redefine itself to meet its needs. If you have that, you can just release a small core and let libraries define all the fancy language features people like. The neat thing about this is that it lets the language move way faster, since cool language features are often created by people who have a good idea, but aren't interested in hacking on c based VMs. There is a time and a place for that sort of thing, and when you are used to it, languages that don't let you redefine themselves start feeling cumbersome and irritating when that time comes, and you are forced to implement something that could have been done in a much more elegant fashion.

Now, all of that is my opinion, as someone who absolutely loves languages like perl, and ruby, and LISP. I know that not everyone thinks the same way, but a great many really smart people do. Hopefully this is a bit of a window into how the "other side of the fence" sees this sort of thing.

Reply Parent Score: 2

vivainio Member since:
2008-12-26

If you have that, you can just release a small core and let libraries define all the fancy language features people like.


I've heard many things about Perl, but never heard it referred to as "small". Every time someone had an idea, they were sure to add it to the core language.

Python is small. It doesn't even support regular expressions in the core language (which is a design flaw both perl and ruby happily make), you'll use the standard library instead.

Reply Parent Score: 2

Neolander Member since:
2010-03-08

I've heard many things about Perl, but never heard it referred to as "small". Every time someone had an idea, they were sure to add it to the core language.

Python is small. It doesn't even support regular expressions in the core language (which is a design flaw both perl and ruby happily make), you'll use the standard library instead.

Python, small ? I can't agree with this.

C, Pascal, and their object-oriented derivatives, are what I call small languages. They have a feature list close to the bare minimum, except for some things like bitfields and enums in C. Python, on the other hand, with its inclusion and high-level manipulation of lists, strings, tuples, and dictionaries, is not exactly what I would call a small language...

Edited 2010-09-12 14:15 UTC

Reply Parent Score: 2

google_ninja Member since:
2006-02-05

I was talking about the benefits of a self modifying language, and was mostly thinking about lisp as I wrote that particular sentence

Reply Parent Score: 2

sreque Member since:
2010-09-10

Don't be so harsh on ruby! In ruby, the perl-like regular expression syntax is just syntactic sugar for using the Regexp class, which looks and feels like any other class in the language. In fact, if you wanted to, you could instantiate and use regular expression objects in ruby just like you would in python. No one usually does this, though, because the sed/awk/perl-like syntax for regular expressions is actually very convenient and helpful. I think this actually gives us the best of both worlds, because the language is still clean and consistent.

This stands in contrast to perl in many ways. For instance, in perl, if you want to assign a regexp to a variable you have to use the qr() syntax, which actually is much less convienent than the normal syntax for creating a regular expression. In ruby, you can just write something like:

re = /my_regular_expression/

which is just syntactic sugar for a properly string-escaped version of:

re = Regexp.new("my_regular_expression")

Reply Parent Score: 1

asdf Member since:
2009-09-23

A powerful language is one that can redefine itself to meet its needs.


I just can't stand that statement. Sure, everyone redefines the language into meeting one's own silly imagined requirements. Powerful for each silly isolated programmer, massive failure as a communication tool among peer programmers. Yeah, go! perl and c++!

Reply Parent Score: 1

google_ninja Member since:
2006-02-05

The more powerful something is, the bigger the hole you can dig yourself. When these things are done in the right way at the right times, they are invaluable. It takes skill, experience, and judgement.

I would agree with you if you are talking about crappy developers. Crappy developers can do much worse things when you have the ability to add or redefine language features.

Reply Parent Score: 3

sreque Member since:
2010-09-10

I know more about Perl than any other developer I've met, and I can hold my own against arguments from the likes of you just fine.

Also, there is a difference between languages like Lisp that give you a small core and let you easily build your own sub-language with macros, and a language like Perl where people have hackily built modules to cover up for past design mistakes. Perl's source transformer system, for instance, is inferior to anything the Lisp world has to offer. At the same time I've also heard Perl 6 improves significantly in this regard, but I won't hold my breath until Perl 6 is out and accepted by the community. Lastly, other scripting languages like Ruby also let you access and transform the AST, but this feature is not used nearly as much in these languages because, frankly, they don't need it nearly as badly as Perl does.

Anything else you'd like to try in defense of Perl? I promise you it is much easier to attack Perl than defend it!

Reply Parent Score: 1