develooper Front page | perl.perl5.porters | Postings from March 2023

Re: strictness and "use 5.whatever"

Thread Previous | Thread Next
From:
Zefram via perl5-porters
Date:
March 8, 2023 13:30
Subject:
Re: strictness and "use 5.whatever"
Message ID:
ZAiN9jYzLtb8Kq32@fysh.org
Graham Knop wrote:
>Relevant discussions:

Thanks, useful references.  Will look.

First thing that I can respond to:

>Proposal to deprecate version "downgrading":
>https://www.nntp.perl.org/group/perl.perl5.porters/2022/02/msg262948.html

In the message there, LeoNerd asks:

}                      Have I missed a valid use-case for stepping
}backwards within the same scope?

Yes, you have.  It is generally useful to be able to embed a piece of
code from one place into a different context, and we have lexical scoping
to enable that sort of thing to be done cleanly.  When borrowing code
that's written for a particular set of features and strictures, one can
easily bring that code's pragmata along with the code itself, and using
those pragmata in the local scope will (mostly) set the lexical state
appropriately for that code.  If one wants to borrow a small piece of code
whose prevailing lexical state is expressed in terms of a version pragma,
and that version happens to be older than that for which the bulk of one's
module is written, then that amounts to a lexical `stepping backwards'.

It's just as meaningful a situation as stepping forwards.  Prohibiting it
would cause an annoyance.  It's not fatal to this kind of code reuse,
because one could reexpress the prohibited pragma in terms of its
constituent strictures, feature bundle, and so on.  But there's no good
reason to discourage or impede this kind of use.

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About