Re: Comments on non-unique naming convention for closures
| From: | Terry Ellison | Date: | Tue, 03 Dec 2013 13:01:00 +0000 |
| Subject: | Re: Comments on non-unique naming convention for closures | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70491@lists.php.net to get a copy of this message | ||
Hi Derick,
Thanks for this. What you are rewriting here is the function name of the closure being executed and which is the backtrace. As I said in my O/P, the closure contains a deep copy of the magic-named version stored in the EG function table. The closure copy is always called {closure} at the moment, but the original version has this supposedly unique magic name that I now want to make unique. Hence we have two separate issues: * What do we name the zend_function structure in the closure object? As you suggest, it would make a lot of sense here to make this meaningful to the programmer so {closure:<filename>:<start-line>-<end-line>} is a lot better than the current {closure}. Hoisting your approach into zend_closures.c would make a lot of sense. Note that this name doesn't need to be unique. * What do we call the template copy in the EG function table? This is never exposed to the programmer, so it's name is unimportant in these terms, but it should be unique for a given closure source. Regards TerryWhat I am suggesting is that this convention should be changed for something like "\0{closure}$name$ctime$index" or even just "\0{closure}$uuid" using the standard UUID algo. Reactions? Comments?For Xdebug to show them in stack traces, and for profiling, I rewrite them to: {closure:/path/to/closure-stack-trace.php:4-7} Seehttps://github.com/xdebug/xdebug/blob/master/xdebug_stack.c#L909