Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^7: On Backwards Compatibility and Bareword Filehandles (Orthogonality)

by LanX (Saint)
on Jul 20, 2020 at 01:24 UTC ( [id://11119532]=note: print w/replies, xml ) Need Help??


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

I spend much time training colleagues in Perl.

I'm pretty happy when they understood scoping rules and follow the basics of declaring with my.

And believe me, nobody there thought much about using package before I started there.

There is simply not much room to tell a beginner about all the specialties of a package scoped bareword, which needs to be treated with local, the internals of type-globs and how to pass them around as reference with \*FH .

Yes Perl has many ways to do it and it's impressive how I can always come up with a nifty trick to fix the sins of a 15 year old code base.

But orthogonality rules, they don't need to learn how to use a baseball bat to drive a nail into the wall, if there is a hammer called my $FH and they already learned to use that hammer with many other nails ...

And there is no issue with "backwards compatibility" whatsoever!

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

Replies are listed 'Best First'.
Re^8: On Backwards Compatibility and Bareword Filehandles
by jcb (Parson) on Jul 20, 2020 at 02:10 UTC

    To be clear, I am content with the status quo, but it seems that there is an effort afoot to remove bareword filehandles entirely, and I present this proposal as an alternative change that will cause less breakage than the previously proposed change of removing the feature entirely. I do not think that I can get indefinite continuation of the status quo, so I make this proposal as a "next best thing" from my perspective.

    You raise a good point that existing code expects to be able to pass a reference to a bareword filehandle with \*FH. The parser could still accept that syntax and consider it another form of {I/O}FH, but the \* would no longer be required. This would allow passing filehandles as arguments to I/O builtins and user subroutines equivalently.

    I am not saying that my $FH should stop working, only that "plain" filehandles should become equivalent to that in preference to being removed entirely. I also see some opportunities to simplify the interpreter guts along the way, which is a suitable justification for change, especially when efforts are made to maximize compatibility with existing code that does not use my $FH, as this proposal seeks. Since you mentioned that even package was not being considered at your workplace before you started, how likely are there to be other places where my $FH is still entirely unknown? How much code will they have?

      > seems that there is an effort afoot to remove bareword filehandles entirely

      No, there isn't!

      Good night! :)

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11119532]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-03-28 16:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found