Req #68510 [Opn->Sus]: Support aliasing with the use operator
| From: | stas@php.net | Date: | Fri, 04 Aug 2017 23:21:48 +0000 |
| Subject: | Req #68510 [Opn->Sus]: Support aliasing with the use operator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-210499@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68510&edit=1
ID: 68510
Updated by: stas@php.net
Reported by: eric dot lewis at nytimes dot com
Summary: Support aliasing with the use operator
-Status: Open
+Status: Suspended
Type: Feature/Change Request
Package: *General Issues
Operating System: CentOS
PHP Version: 5.6.3
Block user comment: N
Private report: N
New Comment:
Thank you for your interest in PHP and for submitting a feature request. Please be aware that due to
the magnitude of change this request requires, it would be necessary to discuss it on PHP Internals
list (internals@lists.php.net) as an RFC. Please read the guide about creating RFCs here:
https://wiki.php.net/rfc/howto
If you haven't had experience with writing RFCs before, it is advised to seek guidance on the
Internals list (http://php.net/mailing-lists.php) and/or solicit help from one of the experienced
developers.
Please to not consider this comment as a negative view on the merits of your proposal - every
proposal which requires changes of certain magnitude, even the very successful and widely supported
ones, must be done through the RFC process. This helps make the process predictable, transparent and
accessible to all developers.
Previous Comments:
------------------------------------------------------------------------
[2014-11-26 22:26:11] aharvey@php.net
See also: https://wiki.php.net/rfc/useas and http://marc.info/?l=php-internals&m=134262361326161&w=4
This would need to go through the RFC process as well (nowadays, also with an appropriate spec PR).
------------------------------------------------------------------------
[2014-11-26 22:16:49] eric dot lewis at nytimes dot com
Description:
------------
I'd like the ability to alias any variable when applied with the use operator.
Currently, you must alias objects or array elements before the use operator, and pass the aliased
value to the use operator. This could be simplified.
Test script:
---------------
<?php
// Currently in PHP, you must alias before invoking the use operator.
$sword = new stdClass();
$sword->length = 3;
$length = $sword_length;
function() use ($length) {
// .. do something productive with $length.
}
// Using the as operator here seems more intuitive to the language's existing syntax.
$sword = new stdClass();
$sword->length = 3;
function() use ($sword->length as $length) {
// .. do something productive with $length.
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68510&edit=1