Re: Calling symbol table patch
| From: | Sterling Hughes | Date: | Tue, 21 Nov 2000 09:12:42 +0000 |
| Subject: | Re: Calling symbol table patch | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-38772@lists.php.net to get a copy of this message | ||
At 11:08 AM 11/21/2000 +0200, Stanislav Malyshev wrote:
SH>> I don't think its really a good idea for a function to have SH>> access to the scope of the function that called it (and be able SH>> to modify it). That just makes me a little queasy somehow. SH>> You shouldn't be able to modify and access one functions scope SH>> from another function. I think the solution might be adopting something like Perl's scoping - real local variable (Perl's "my", PHP locals), "propagating" variable, that is defined in all calling functions (Perl's "local") - I guess this could be implemented just by joining symbol tables and should not have speed impact unless you really use it. Thus, you can allow called functions to access some variables. Only calling them "local" a-la Perl is not so good, except for "brand recognition" reasons, because they are not locals. More successful names are welcome.I don't quite understand you, local() creates a local copy of a global variable. It is most often used when, in Perl, you don't want to modify the actual values of "true" globals (not package variables), you just want to make temporary changes. {
local $/ = undef;
#
# Slurp the entire file into $file
# now that $/ is undef instead of the default
# \n
#
$file = <FILEHANDLE>;
}
I don't see how this applies, perhaps you can give some sample code to display what you mean.
-Sterling