Re: Idea to extend language: Explicitly setting variable scope inside user defined function (longer)

From: Date: Mon, 21 Oct 2002 15:50:03 +0000
Subject: Re: Idea to extend language: Explicitly setting variable scope inside user defined function (longer)
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-89805@lists.php.net to get a copy of this message
----- Original Message ----- From: "Andi Gutmans" <andi@zend.com> To: "NTPT" <ntpt@centrum.cz>; <php-dev@lists.php.net> Sent: Monday, October 21, 2002 7:15 AM Subject: Re: [PHP-DEV] Idea to extend language: Explicitly setting variable scope inside user defined function (longer) > I think having something like "caller" is very bad. It would mean that > functions don't have any contracts anymore as they > can start messing around with the callers symbol table. could you explain more exactly ? if you means what I mean ( i am nod good in english) by phrase "they can start messing around with the callers symbol table" ? I suggest to optionary explicitly control by PHP programmers the variable scope by using combination of : var_scope 'caller', globals variable list local_vars (list of variables that are to be in local scope only) So PHP programmer, if use explicit variable scope control in some function, will have a full power and FULL RESPONSIBILITY too, to set your variable scope correctly for his purposes. If the function bar() with var_scope set to 'caller' mess something in foo(), from where bar() was called, it was a php programmer fault, like other errors between chair and keyboard. Yes, it will be useful to force function parameters and return variable to be a local_vars only. > > Andi > > --- Odchozí zpráva neobsahuje viry. Zkontrolováno antivirovým systémem AVG (http://www.grisoft.cz). Verze: 6.0.401 / Virová báze: 226 - datum vydání: 9.10.2002

« previous php.dev (#89805) next »