Re: Remove variable function and method calls

From: Date: Fri, 23 Jul 2010 00:49:39 +0000
Subject: Re: Remove variable function and method calls
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-49116@lists.php.net to get a copy of this message
On Thu, Jul 22, 2010 at 5:42 PM, Joel Perras <joel.perras@gmail.com> wrote: > What's confusing about it? Each expression means something very > different and distinct. > > I use $foo(), new $foo(), classname::$foo, classname::$foo(), > $bar::$foo, $bar::$foo(), etc. on a regular basis, and it can make for > some very elegant, concise and readable code. So you do not consider it utterly confusing that classname::$foo classname::$foo() mean two completely different things? The first reads a property the second reads a local variable. Any time you need to backtrack when you the source code because something you tackled on after changes the meaning of the code completely is considered horribly confusing in my opinion. And then it's utterly nontrivial what new $foo() *should* do. Should it call $foo() and instantiate the class name found in the return value or should instantiate the class found in $foo? If you nuke variable function calls and method calls and replace them with call_user_func() then these go away. Regards NK

« previous php.internals (#49116) next »