I'm most grateful to those who've troubled to kick in their $/50 or £/50 or whatever - perhaps even e/50 these days... whatever... it's been, if nothing else, an educational canter around some of the topics in this area.
I take the points against my madcap scheme. But I'm not completely convinced (yet). Often one does want to keep the subroutine completely independent of the calling scope. But sometimes one (by which I mean "I" - and it may be this is a sign I'm getting other things wrong) have several different scopes that repeat the same, or roughly the same, bit of code. Just a little snippet, nothing fancy, but repeated a dozen times it begins to get heavy.
And I know the canonical solution to this added weight is
$RAM->buy('more')
But at the same time, it wd just be nice to be able to write that snippet out once only. On the other hand, if I have to surround it with variable declarations and mechanisms for recovering variables, and if I have to pass it a whole load of arguments (and
think about which arguments I'm passing) then it begins to be more trouble than it's worth.
Likewise if the result is a proliferation of global variables, that's a bad idea - I'd like the variables in the subroutine to go out of scope when I leave the calling scope. And full-qualified variables are at least aesthetically unattractive.
What I'd like is a pragma that I can use at the start of a package that merges that package's namespace with the namespace from which it was called. I don't know from perlguts, so this may be an impossible dream. And I'm still ready to be convinced it's a mad dream, or that it's a dream that is already a reality if I but knew how to do it. But it IS still my dream...
§
George Sherston