Simon Cozens wrote:
> Please don't try defending "it" or "$^d" in terms of efficiency;
> any variable that Perl has to keep track of magically takes a
> performance hit. Remember $`, $', and $&?
No, this datum is already known by defined() and exists() all I
am suggesting is a name for the Perl API name for it. Well, it
isn't currently in 5.6.1's
bool
Perl_hv_exists(pTHX_ HV *hv, const char *key, U32 klen)
function (contrary to what John Porter said) but adding it,
as extended defined/exists that Only Gets Called When It
Immediately And Obviously Precedes Use Of The Magic Variable,
would save the later lookups.
This is a "Little thing that can just be thrown in" and is nothing
more than that.
Making $', $`, and $& lexically scoped too could solve their
performance hit issues too. They're convenient.