Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • "Modern languages have so many features that they must keep the grammar small in order to reduce the learning curve" ... for tool writers.

    God knows it makes life easier.

    My (modified and I hope more accurate) argument would be that a simpler syntax makes writing editors and other tools easier, and the quality of the tools make learning and using a language easier.

    Perl doesn't do well on that metric either :/

    • You're right, it is all about context, and even then, it is very subjective. Which is why we have so many languages with so many differences. We don't agree very much on the Best Way.

      I read some of this article and man, it's got screwy logic. Like "variables are global by default" is bad. Why? There's no objective truth there. And if he doesn't like it, use strict and the problem goes away. BFD.

      And then there was this gem:

          ${$arrayRef}[0]=4;  #YUCK! Modify the callers array.
      Yet he had no problem with this:

          array[0]=4;    #Modify the callers list
      So why didn't he just do this?:

           $arrayRef->[0]=4;    #Modify the callers array
      Probably because he didn't know. Heck, don't even call it arrayRef. If you are calling $array, you already know it is an arrayref. Just do:

           $array->[0]=4;    #Modify the callers array
      Now would he say "YUCK!"?

      As to "passing by reference" being "ugly," I don't see why. I see it as clear and logical. But whatever, if you don't like, then use all references to begin with. No big deal. But this from someone who complains about changing the "prefix."

      And then he appears to think that print should actually MUNGE YOUR OUTPUT.

      If he knew Perl, he could be perfectly happy, I imagine, with this, apart from parameter passing:

      use strict;
       
      sub func { # You've got to be kidding parameter passing.
                 # Perl 6 intends to fix this.
          my ($x,$array)=@_;
          #$i=2;  # This won't compile
          ++$x;
          $array->[0]=4;  # Modify the callers array.
          #$newvar= 'abc'; # This won't compile
          print $x,"\n";
          return(1);
      }
      my $i=1;
      my $array= [1, 2];
      my $x=func(1,$array);
      #print $newvar,"\n";  # This won't compile
      print "i=$i\n"; # i is 2
      $array->[1]=0;
      print "$array->[0] $array->[1]\n";  # prints 4 0
      I think it shows that he doesn't really understand Perl, and he is arguing largely from ignorance.

      • > I think it shows that he doesn't really understand Perl, and he is arguing largely from ignorance.

        Yup, pretty much.

        I'd say there's really not any useful points to recover from that article, except what we already know about the relationship between grammar and tool quality.