in reply to Re^7: magic-diamond <> behavior -- WHAT?! (dock)
in thread magic-diamond <> behavior -- WHAT?!

The example pseudocode was written before three-argument open existed in Perl. I fail to see how that makes for a binding decision once the recommended non-magic open came along.

I'm not going to get into the middle of the argument at this particular time of whether the behavior should be changed to use three-argument open or stay the way it is. I'm fairly ambivalent about this topic currently, partly because being a lone-wolf coder on smaller projects I have the luxury of knowing the contents of my directories really well. I cared more about the status of this feature when I was handling large numbers of other people's files on a server.

I do expect people who are making strong arguments one way or the other to have strong points, though. This particular line of argument does not appear to me to be a very strong one. If I was defending your position, I'd look for some better points to make than that the old pseudocode in the documentation shows the function that was available at the time the documentation was written.

  • Comment on Re^8: magic-diamond <> behavior -- WHAT?! (dock)

Replies are listed 'Best First'.
Re^9: magic-diamond <> behavior -- WHAT?! (dock)
by Fletch (Bishop) on Nov 05, 2008 at 18:25 UTC

    The original 20+-year old code has no "pseudo-" qualifier. Read it again and please point out where it says anything about that being "pseudocode". I don't know how much clearer it could be, but:

    THE ONLY REASON THAT SNIPPET IS CALLED PSEUDOCODE IN THE CURRENT DOCUMENTATION IS THAT IT USES THE NAME ARGV FOR A FILEHANDLE AS IF A FILEHANDLE WITH THE NAME ARGV WERE NOT OTHERWISE MAGIC.

    IT IS OTHERWISE THE EXACT SAME FRELLING REAL PERL CODE FROM VERSION 1.0'S MANUAL PAGE, AND WERE YOU TO SIMPLY CHANGE THE NAME OF THE SAMPLE FILEHANDLE FROM ARGV TO FRED IT WOULD WORK THE SAME AS <>.

    SAYING THAT MAGIC <> WAS MEANT TO BE NOT MAGICAL BECAUSE OF THAT DISTINCTION IS MISSING THE POINT OF THE QUALIFICATION COMPLETELY.

    Two-argument open has always been magic for filenames begining or ending in pipes (which are referred to (and have been referred to as such for, again, 20+-years) as just 'filenames' and not 'sooper magical pipey filenames of justice' or what have you; which means any distinction with regards to two-arg open is a misunderstanding as it is two-arg open which imparts special meaning upon filenames of a specific format). <> is magic. <> has always been magic. If you don't want the magic, you don't use the magical form either back 20+-years ago or with the current versions. But to say that it never was intended to be magic is just ahistorical revisionism, and was pointed out as such during the discussion on p5p.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      You are now just being rude for no reason.

      It really doesn't matter whether it was pseudocode, if it's exactly equivalent, or even if perl translated <> directly to that code before generating the final AST. It still doesn't mean that documentation written reflecting the use of two-arg open when there was no three-arg open means that the magic <> had to remain using the magical two-arg open. It just doesn't follow.

      The reason it continued to use the magical two-arg open was a policy decision that those using it that way shouldn't have to change their programs. It's about backwards compatibility being important to people on p5p and has nothing to do with documentation that simply could have been updated. tye's argument is that saner and more secure behavior in this instance outweighs backwards compatibility of a little-used feature.

      Those who have valid arguments to the contrary favor the backwards compatibility. That's it. It has nothing to do with a new Perl programmer needing to go back through every version of documentation written over the past 20 years. It has to do with backwards compatibility of the code written using the feature.

      Perl 5.10.0's docs are to document Perl 5.10.0 and not to document Perl 1. There are also these documents called deltas. They explain what is different from one version to the next, and they really exist. If the policy decision about whether to make <> work with three-arg open once it was available fell the other way, the new version's docs and and delta (for example, perl51000delta or if it changed between now and then perl5120delta) could reflect how it is in the new version and how that differes from old versions, respectively.

      You have wasted your block-quoted, all-capital, all-bold, fake cursing rant accusing people of misunderstanding simply because they find fault with your argument all for naught, because I still don't care if the behavior is changed or not.

      Now sod off and let the adults discuss this, you insolent little bitch. There. I can be rude, too. It doesn't make my point any stronger, and your rudeness does nothing for yours, either.

      A reply falls below the community's threshold of quality. You may see it by logging in.