|There's more than one way to do things|
Re^3: RFC: pragma pragmaticby sundialsvc4 (Abbot)
|on Aug 10, 2017 at 01:24 UTC||Need Help??|
Well, I am of course fully aware of the previous postings, and (in fact) of the technical contexts in which they were made ... (gasp! down-voters, it is true!), but I suppose that the locus of my concern understands all of that. (And, before you reflexively down-vote this post,
I consider pragmas such as use strict and use warnings to be completely unrelated(!) to situations such as this, even though the same syntactic-keyword, use, is “used” in both cases.
To my way of thinking, constructs such as use strict and use warnings are nothing more and nothing less than “ways to flip compiler-switches, which are considered only ‘at compile-time.’” They are strictly applied at compile time, to the limited extent that languages such as Perl possess a concept of “compile time,” and specifically do not influence the run-time behavior of the code. Therefore, to my way of thinking, only(!!) these things qualify as “lexical.”
Per contra, the features that you describe ... (IMHO!) ... do not.
At the very moment that you, as you say, “make the scope of imported functions from some arbitrary package purely lexical,” or, “limited the scope of imported subroutines/functions to <anything_at_all>,” I would stress that (IMHO) you (of course, whoever you are ...) have just now called upon the language system to impose your own view of things upon the (unknown and unknowable) prerogatives of the original programmer of that “arbitrary” package.
Truth be said (IMHO!), you have just done something that said original programmer not only did not anticipate, but could not have anticipated. I would argue that you have co-opted that programmer’s intention, which, I would also (respectfully!) argue, is something that you must not do. Because you can be assured of success only in limited ... and, well-known to you ... cases. Maybe it is no big deal. Maybe it is huge. (And, who’s to know? It worked for you. Goody for you.)
Please, please, understand the point-of-view from which I am coming: unlike most of the apparently-present population of PerlMonks, I am never the original programmer. The original-programmers quite likely have either been fired, have quit, or have been laid off, or have been sent back to the foreign-countries from whence they came. To my way of thinking, the things that you describe are not “lexical,” because they are not in fact of such a nature that can be objectively resolved, entirely by the compiler, “at compile time.” I can’t look at your source code and be certain what it means. I might potentially have to guess what version of a (highly-volatile, say) CPAN package you might have been considering at the time that you decided, “okay, this works.™”
(Mind you, I am not there to judge you. After all, why should I care ...?) But you have imposed upon me an “out-of-band consideration,” of very-large and very-uncertain potential impact, which I am now (very unpleasantly) forced to consider. Thanks a lot.)
Hence, such matters have become something that is near and dear to my ... career. To me, your idea introduces into the source-code many side-effects that are difficult if not impossible to discern from any simple reading of the source-code alone. (Which is all that I ever have to work with.) Instead, the “proper interpretation” of “what I see in front of my face” is now made dependent upon the inner workings of “an arbitrary package.” (And, what version of that thing might you have used ...? Oh, dear.)
I freely grant that my point-of-view might be considered to be “an edge case.” I have become accustomed to that, also. But I submit, all-too defensively now, that it is valid.