Hi Sara, I have to take exception to the section of the RFC titled "File collection Example", where you take a block of code and re-write it to be more readable, using the RFC's syntax.
However, it is not the proposed new syntax that makes the code more readable - it is solely due to writing it in the correct order that makes the code more readable. This can be done using current PHP syntax, so that the code is: $dirEntries = scandir($arg); $files = array_filter($filesAndDirectories, function($x) { return $x !== '.' && $x != '..'; }); $fullPaths = array_map(function ($x) use ($arg) { return $arg . '/' . $x; }, $files) $fileInfo = getFileArg($fullPaths); $ret = array_merge($ret, $fileListInfo); Using the proposed new syntax to rewrite it without the intermediate variables like this. $ret = scandir($arg) |> array_filter($$, function($x) { return $x !== '.' && $x != '..'; }) |> array_map(function ($x) use ($arg) { return $arg . '/' . $x; }, $$) |> getFileArg($$) |> array_merge($ret, $$); Does not now show a marked improvement in readability. Showing the benefits of an RFC by comparing 'apples to oranges', is at least to some extent 'pulling a fast one'. Do you have any examples where the original code is not terrible, that show an increase in readability? (By implication, I am not persuaded by the PSR 7 ones.) Larry Garfield wrote: > The absence of an intermediate variable name does not inherently hinder > readability/debuggability (nor does its presence inherently improve it). I disagree strongly, the presence of intermedite variables does help the code be more understandable. It gives semantic meaning to the steps in involved in the process, as well as giving variables that can be watched in a debugger. If people want the excitement of not being able to figure out what the intermediate variables mean, then they can already do so by using terrible variable names. >From the first "PSR7 Example", we could write the code like: $v = getGlobals(); $v = parseRequest($v); $request = buildPsr7Request($v); If you truly believe that not having semantically meaningful intermediate variable names, you would have no problem with code being written like this, right? Personally, I always use semantically meaningful variable names, as they make life so much easier for any person who needs to read the code. cheers Dan -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php