Re: Lexical scoping

From: Date: Wed, 29 Jan 2014 08:40:41 +0000
Subject: Re: Lexical scoping
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-71716@lists.php.net to get a copy of this message
Hi! > Perhaps a future version of PHP (PHP 6? 5.7?) could have lexical scoping with a > "let" keyword? At the very least, it would make foreach() with a reference less > of a problem: > > foreach ($array as let &$a) { > $a = 3; > } > // $a is not in this scope - no need to worry about accidentally changing > last array item Typing unset($a) takes about 3 secs. Since you need to make additions anyway, and you can already easily do it in the language - I don't see any need for introducing new syntax. The use case for it seems pretty small and already served by unset(). -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227

« previous php.internals (#71716) next »