I was recently reading an article somewhere (I've lost it since) that claimed that "...Perl encourages a lack of discipline..." For a moment or two, I thought that might be correct. I realized, though, that it's not.

Perl allows a lack of discipline, but that's not really the same as encouraging it. Unlike some B&D languages like Pascal, Perl will allow me to do some very careless and risky things, if I want. Perl does not force me to behave myself. Leave off the use warnings and use strict pragmas, and Perl will let me do all kinds of things without complaint. If I'm just throwing together a quick script for a once-off job, I don't have to declare all my variables and #include header files.

On the other hand, I can also use the pragmas and OO programming to be as disciplined as I want. It's up to me.

Perl is about freedom to choose how much or how little discipline I want. It's up to me, not someone else who wants to protect me from myself. Larry and company no doubt have some opinions about discipline, but they don't impose their ideas on me. They let me choose. They trust me to choose wisely (or, sometimes, to pay the consequences).

Replies are listed 'Best First'.
Re: Perl and Discipline - and Freedom
by xdg (Monsignor) on Aug 09, 2005 at 05:01 UTC

    I'd say it's not so much about Perl as it is about freedom in general. To those who are less free (or want to keep others less free), freedom == disorder == lack of discipline. In the (geo)political realm, that kind of sentiment is often heard from totalitarian governments/movements about the dangers of freedom (particularly as it relates to crime and morality). I suppose that could lead us down an amusing digression comparing various programming languages/frameworks to political/economic systems...

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: Perl and Discipline - and Freedom
by adrianh (Chancellor) on Aug 09, 2005 at 13:31 UTC
    Perl allows a lack of discipline, but that's not really the same as encouraging it. Unlike some B&D languages like Pascal, Perl will allow me to do some very careless and risky things, if I want. Perl does not force me to behave myself.

    Actually I do think there are places where Perl does encourage lack of discipline - in that the "bad" way of doing some things is simpler and/or more obvious than the "good" way.

      I do think there are places where Perl does encourage lack of discipline

      Sure, I'd even go so far as to say there are a lot of places like that. But a lot of problems don't require much discipline at all to solve. I think it's great having a language to make those easy things easy, as the cliche goes.

      On the other hand, when the problem at hand does require more rigor, Perl can usually accomidate that. It may be more work -- which I suppose is sort of implied by "discipline" -- but it's possible. It's the flexibility of Perl that I really like, not the type of code it enables or encourages.

      Update: I don't feel a further reply to his reply is necessary, but I do want to say I agree with adrianh completely.

        On the other hand, when the problem at hand does require more rigor, Perl can usually accomidate that. It may be more work -- which I suppose is sort of implied by "discipline" -- but it's possible. It's the flexibility of Perl that I really like, not the type of code it enables or encourages.

        Yeah, but in many cases there is no clash between flexibility and the "right way" of doing it - it's just poor design in Perl 5. The addition of decent simple OO encapsulation of state and behaviour in Perl 6 don't make the language less flexible, they just make it far simpler to write "good" code.

Re: Perl and Discipline - and Freedom
by biosysadmin (Deacon) on Aug 09, 2005 at 21:11 UTC
    Perl encourages a lack of discipline in the same way the First Amendment to the US Constitution encourages improper speech. It may provide a way to express one's lack of discipline, but I don't think that's the same as encouraging that lack of discipline.