in reply to Re^2: On Backwards Compatibility and Bareword Filehandles
in thread On Backwards Compatibility and Bareword Filehandles

Is open state also conditional currently or will it replace an already-open handle?

Sorry, but I have to say: You already didn't do your due dilligence in the root node, and now you seriously expect me to do more of your work for you to support an argument I don't necessarily agree with? The internet being what it is, my troll-o-meter is going off.

  • Comment on Re^3: On Backwards Compatibility and Bareword Filehandles

Replies are listed 'Best First'.
Re^4: On Backwards Compatibility and Bareword Filehandles
by syphilis (Archbishop) on Jul 18, 2020 at 13:35 UTC
    The internet being what it is, my troll-o-meter is going off

    Seems a bit harsh - this monk has continually provided quality advice, and in a manner that exudes earnestness and a genuine interest in the betterment of perl.
    Mind you, there's a bit going on here that I simply don't understand - especially posts by YourMother and LanX which appear to be angled towards provocation more than anything else.

    In terms of the original post of this thread, I have some sympathy.
    While I see potential pitfalls in the use of bareword filehandles, I don't regard that it is necessary to enforce defaults that forbid such usage.
    But then ... I don't really have anything against scalar filehandles and I'm a person who values pragmatism over integrity so I've just gone through the various test scripts of my cpan modules that use bareword filehandles, replacing them with scalar filehandles. (This is just so I'm prepared for what the future might bring.)
    It wasn't so hard ... just put a "$" in front of every bareword filehandle in the script, then declare a "my" for every one of those scalar filehandles at the beginning of the script.

    Cheers,
    Rob
      this monk has continually provided quality advice, and in a manner that exudes earnestness

      I don't disagree entirely, but to me that only makes it more disappointing that recent threads went as they did; I saw several factual errors, strawmen, ignoring facts and arguments (all of which I called out at the time), and in the case of this thread, which is a continuation of the same topic (bareword filehandles), missing even the most basic testing, followed by what felt to me like a tactic to get me to waste my time. That interpretation is likely to be affected by my experience in the previous threads, but sometimes even normally reasonable and otherwise knowledgeable people can slip into "troll tactics", which is why I worded myself the way I did.

      In terms of the original post of this thread, I have some sympathy. While I see potential pitfalls in the use of bareword filehandles, I don't regard that it is necessary to enforce defaults that forbid such usage.

      Note the root node says (emphasis mine): "Rolling pragmas like use strict; into defaults is reasonable, as long no strict continues to exist. ... The proposal to remove [Indirect Object syntax and Bareword Filehandles]". To my knowledge at this point, there is no proposal to remove bareword filehandles, as you noted yourself. I'm currently only aware of one mention of making no bareword::filehandles a default, which I can't find in the current plans anymore either.

      But anyway, Sawyer went through a fair bit of explanation in his talk of the reasoning behind changing the defaults. In addition to my getting the feeling several people participating in the Perl 7 discussions haven't watched the talk, I think people who are complaining about the (supposed) removal of features are missing some important points: 1. Perl 5 will continue to exist and get maintained for a fair amount of time (apparently at least 5 years). I completely understand people saying they wish to maintain their artistic freedom to code how they like - and if their medium of choice is Perl 5, it will always be there for them. 2. Changing defaults is much, much less radical than actually removing features - so in Perl 8, you may have to write use bareword::filehandles to enable a feature with many disadvantages. I don't believe that's bad enough to warrant a comparison to book burning. And even if Perl 9 or 10 were to actually remove them, point 1 still applies, plus someone (perhaps OP?) can probably write a CPAN module to put the feature back in. (In fact, Sawyer is working on a standard syntax for Perl that would actually allow for static parsing, allowing for actually safe source filtering; see also his talk.)

      You said here:

      Maybe I should just wait and see what happens ?

      That's definitely my attitude at the moment. Perl giveth (powerful Unicode features, s///r, postderef, and lots more) and Perl taketh ($[, smartmatch probably), and we can pray that better things are to come (signatures, refaliasing), but in the end, it's the smart people who spend their time giving us stuff for free that make the decisions. There's already enough heated discussion going on, we don't need to burn them out further.

        sometimes even normally reasonable and otherwise knowledgeable people can slip into "troll tactics"

        "Slip" is very much a good way to describe it. I had thought of "why not give bareword filehandles lexical scope, too?" as a solution to the problems of file-scope lexicals being effectively global variables. I had a "lightbulb moment" and rushed to write it down in a somewhat coherent form. The root node of this discussion was the result.

        To my knowledge at this point, there is no proposal to remove bareword filehandles

        I will answer this by quoting more from Announcing Perl 7, the original announcement:

        What’s disappearing?

        [...] There are some things you should learn to live without, even in Perl 5 land. These are the likely candidates for the first round of changes:

        • indirect object notation
        • bareword filehandles (except maybe the standard filehandles)

        That announcement specifically mentioned removing indirect object notation and bareword filehandles. That detail seems to have been reconsidered after it proved extremely controversial.

        in Perl 8, you may have to write use bareword::filehandle­s to enable a feature with many disadvantages

        I propose that we take advantage of a major version bump to replace that feature with a mostly-compatible (what I expect is the most common case would continue to work) near-equivalent that brings the advantages of the new model to the old style.

        As far as the features you mention, $[ was recognized as a mistake and has been variously either a lexically-scoped compiler directive or read-only for almost the entirety, if not the entirety of Perl 5, and smartmatch, like pseudohashes, was never promoted from experimental status. Experimental features should not be carried across major versions — either they are good enough to become part of the core language at such a time or they should be dropped.

      > Mind you, there's a bit going on here that I simply don't understand - especially posts by YourMother and LanX which appear to be angled towards provocation more than anything else.

      Come on, I was making fun of Godwin's law, and I made clear it's ironic.

      This whole thread isn't of big interest for me because nobody is planning to remove features from Perl 7, just readjusting pragma defaults.

      Everything else smells like a conspiracy theory out of online hysteria.

      Humor might help, don't you think?

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

Re^4: On Backwards Compatibility and Bareword Filehandles
by jcb (Parson) on Jul 19, 2020 at 02:54 UTC

    Fair enough; I missed that a feature that I had never tried to use was in fact already implemented. I have generally stayed with the 5.8 feature set because I am a big fan of backwards compatibility. I had forgotten to check if that generalization had already been done; mea culpa on that.

    I use open my $foo,... to open a file in a sub and open FOO,... for the same at top-level. Having not actually needed open our or open state, I did not know that those already exist.