> > my sub foo ($_ = $_) > > > > to just propagate the outer $_ inward. > > That only works when $_ can somehow be > shoe-horned into the parameter list. > Whereas: > > my sub foo is given($_) > > works for *any* parameter list.
Other than the placeholder situation, I don't understand when one could do the 'is given($_)' and not do the ($_ = $_). > > Possibly we have something more evil than > > that, such as the notion that $? is a double > > sigil that pulls a name out of the dynamic > > context's lexical scope. > > 1. Do we really want to allow every lexical to > be accessible anywhere in its dynamic scope? It is intriguing. One only needs to know the def of a sub one is calling. One does not have to worry about subs that get called by the sub one is calling. Imo one should know the def of a sub one calls. In this case one needs to know the pertinent arg /names/, not just their position, but that is already somewhat the case for optional args. When writing in the, er, medium (as against small or large), one could develop a variable name vocabulary, rather as one does with globals, but without its dangers: A (horrible, but hopefully illustrative) example: my $filename = 'foobar'; my $buf; open; read; write; delete; I'm imagining a potential sweetspot between globals and lexicals. An extension of the power of "it", which is just a way to talk more succinctly when you can get away with assumptions about nearby nouns. No? > 2. If we *do* want to provide that mechanism, > do we really want to make it that easy/subtle If the sweetspot I theorize above exists, then I think my answer is 'yes' to easy. But, no matter what, NO to subtle. It would be important that people know that any given arg is, er, given, or one just ends up with something that is halfway to the usual global problem. I'm thinking the syntax should be, in order of priority, LOUD, short, pleasing. I'm also thinking it would be nice to be able to say that the called sub's lexical shares its name as well as value (copy or bound) with the calling sub's lexical, without having to say the name twice. Further, that this would be a good pick as the norm, with the syntax optimized for that, so that it may be more cumbersome when you want the formal and actual arg names to be different. Perhaps we need some Unicode? ;> -- ralph