Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

irritation makes perls

by xyzzy (Pilgrim)
on Sep 24, 2009 at 19:09 UTC ( #797282=perlmeditation: print w/ replies, xml ) Need Help??

I love Perl. It is definitely my favorite language out of the ones I know well enough to work in, and when using other languages I sometimes wish they had some of the features and shortcuts you can use in Perl. Yet there are a few aspects of Perl which annoy me to no end. Such as the fact that there are two sets of comparison operators. Using == with strings accounts for at least 90% of my mistakes. What "features" of Perl irritate the fellow Monks?


"Everything is true." "Even false things?" "Even false things are true" "How can that be?" "I dunno man, I didn't do it."

Comment on irritation makes perls
Download Code
Re: irritation makes perls
by Anonymous Monk on Sep 24, 2009 at 19:17 UTC
Re: irritation makes perls
by Anonymous Monk on Sep 24, 2009 at 19:44 UTC
    I hate when I misspell shift and think the element should come out the other end.
Re: irritation makes perls
by GrandFather (Cardinal) on Sep 24, 2009 at 20:03 UTC

    Occasionally I get tripped up by the difference between:

    print anId("Stuff");

    and:

    print anId ("Stuff");

    Having my own views on how white space ought be used, I find this behaviour particularly nasty. It really doesn't DWIM!


    True laziness is hard work
      Thank you, Grandfather, for another good reason to use indirect filehandles. Whitespace dependencies make me shudder.
Re: irritation makes perls
by chromatic (Archbishop) on Sep 25, 2009 at 02:01 UTC
    Yet there are a few aspects of Perl which annoy me to no end. Such as the fact that there are two sets of comparison operators.

    You'd like the language much, much less if there were only one set of comparison operators. Perl would have to guess about which type of comparison you meant, and the heuristics for guessing rely on a lot of potential scary action at a distance. These bugs happen occasionally (I can think of one I've seen in the past decade), but they'd be much, much more common if you couldn't specify your intent for a comparison.

      I don't deny that a language needs to be able to differentiate between numeric and string comparisons, but it's a hard habit to break coming from other languages. Like remembering how to spell elsif.


      "Everything is true." "Even false things?" "Even false things are true" "How can that be?" "I dunno man, I didn't do it."
Re: irritation makes perls
by Herkum (Parson) on Sep 25, 2009 at 14:21 UTC

    Such as the fact that there are two sets of comparison operators

    Would you rather do what all the other languages do, declare every variable as specific type( a string, a number, a null, or an object). I can live with two operators.

    Using == with strings accounts for at least 90% of my mistakes

    You must be use to another language, like Javascript. This is not a problem with Perl, but rather what you have become used to.

      Turns out you shouldn't use == in javascript, JS doesn't have warnings/strict (although it will have strict in the future)
      '' == '0' // false 0 == '' // true 0 == '0' // true false == 'false' // false false == '0' // true false == undefined // false false == null // false null == undefined // true " \t\r\n " == 0 // true
Re: irritation makes perls
by papidave (Monk) on Sep 25, 2009 at 20:37 UTC
    Since I was a C programmer for so long before Perl, I occasionally mistype my code and put == when I ought to use eq. When it does happen, I get a message like Argument "" isn't numeric in ... because I use warnings;, and then it's easy enough to fix. That said, and compiler dependencies aside, there is a purely practical argument for having two equivalence operators: they do different things.

    To understand that, consider the following toy program:

    The string "0.0" is different from the string "0", but it's the same numerically. Yes, we could get the same thing with an overloaded equivalence operator and strong typing on all variables -- but to be honest, I find all that extra code to be a nuisance. Also, the dual-purpose nature of scalars allows us to return "0 but true" from a subroutine and let the caller use it as a boolean pass/fail or numeric count value (see Re: True or False? A Quick Reference Guide for details).
      I don't completely understand your point. In C you have to use strcmp to compare 2 strings. So why would you be used to "=="?
Re: irritation makes perls
by ack (Deacon) on Sep 28, 2009 at 15:15 UTC

    This is one of those nit-picky things that annoys me, but that I've gotten used to and it rarely bites me anymoer. The annoyance is the odd spelling of } elsif { in the if{} structures.

    I've always been curious, why is it elsif rather than elseif?

    As I noted, it is just an annoyance...nothing earth-shattering. On rare occasions I still end up mis-typiing it...I think my typing fingers get ahead of my brain...never a good thing.

    ack Albuquerque, NM
      and what about 'elif'
Re: irritation makes perls
by Zen (Deacon) on Sep 28, 2009 at 19:44 UTC
    The "Object Oriented" features (or hack, depending on your point of view), in their entirety.

    And occasionally I'd like autovivification to be a pragma.

    And compiling perl with VS2005 or later is a downer.

    And the ancient GUI toolkits need makeovers.

    And lack of CPAN quality control/source origin verification.

    ... guess I'll stop here. Much love for perl, though.
      And the ancient GUI toolkits need makeovers
      use Gtk2;
Re: irritation makes perls
by CaMelRyder (Pilgrim) on Sep 30, 2009 at 21:59 UTC
    I hate hate hate the negative logic constructs such as unless.
    ¥peace from CaMelRyder¥
      You don't have to use them :)

      I hate that some stuff just ISN'T there:

      The OO system. It can do pretty much everything you want from a class based OO system, but it's too verbose to the point of discouraging good practices (i.e. no good, fast, standard, portable way doing private instance variables and methods sucks). There are good modules that help, but too late - they have tons of dependencies and most code you're working with won't use them. Class::MOP and related modules should have been in the core since 5.0 and perl's built-in collections should have been based upon the standard OO model.

      No *real* lisp-style macros. Personally, I think lisp macros are probably not workable in perl anyway, but once you've used them, they're absolutely amazing.

      No good inter-thread communication system. Why can't I pass real objects from one thread to another? IMO this makes threads in pure-perl code completely useless. You have to do all the work you have to do in forking code, and the forking code is probably more stable.

      Auto-vification has it's issues too, especially with strict/warnings enabled.

      Everything else, I've already mentioned before too many times. For instance: Re^3: Perl Vs Ruby and Re: No garbage collection for my-variables.

        Sure, I don't have to use them but that doesn't mean that I don't run into them while maintaining other people's code.
        ¥peace from CaMelRyder¥

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://797282]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2014-09-03 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (35 votes), past polls