Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102223 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53064 invoked from network); 11 Jun 2018 06:30:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jun 2018 06:30:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=zrhoffman@ku.edu; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=zrhoffman@ku.edu; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ku.edu designates 104.47.42.108 as permitted sender) X-PHP-List-Original-Sender: zrhoffman@ku.edu X-Host-Fingerprint: 104.47.42.108 mail-by2nam03on0108.outbound.protection.outlook.com Received: from [104.47.42.108] ([104.47.42.108:6474] helo=NAM03-BY2-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2C/1B-62758-1071E1B5 for ; Mon, 11 Jun 2018 02:30:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kansas.onmicrosoft.com; s=selector1-ku-edu; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vTthA/fFpb/xHwtf+HzzCnXp7zyigo0Yx1mSRNeubb4=; b=E11c0ZpNkrkiV+ZyXOz69FzvzUnRTCCYILMoqmk+K4mHRXHjyPFQryx51X6PwcD8EBfbVByG5387RBs09bDw5Q9JltVtFa4BYRa4YJXx0kvLC10cC513gliNUM98SShY5lAoFVXijaue+Y/lh+YPPvlBV06O+epzpGCPJbH74Ng= Received: from MWHPR01CA0032.prod.exchangelabs.com (2603:10b6:300:101::18) by SN1PR0101MB1614.prod.exchangelabs.com (2a01:111:e400:530a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.17; Mon, 11 Jun 2018 06:14:35 +0000 Received: from BN1BFFO11FD027.protection.gbl (2a01:111:f400:7c10::1:105) by MWHPR01CA0032.outlook.office365.com (2603:10b6:300:101::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.841.17 via Frontend Transport; Mon, 11 Jun 2018 06:14:34 +0000 Authentication-Results: spf=pass (sender IP is 129.237.207.23) smtp.mailfrom=ku.edu; gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=bestguesspass action=none header.from=ku.edu; Received-SPF: Pass (protection.outlook.com: domain of ku.edu designates 129.237.207.23 as permitted sender) receiver=protection.outlook.com; client-ip=129.237.207.23; helo=ex13-ell-cr-13.home.ku.edu; Received: from ex13-ell-cr-13.home.ku.edu (129.237.207.23) by BN1BFFO11FD027.mail.protection.outlook.com (10.58.144.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.820.5 via Frontend Transport; Mon, 11 Jun 2018 06:14:33 +0000 Received: from ex13-ell-cr-11.home.ku.edu (129.237.207.21) by ex13-ell-cr-13.home.ku.edu (129.237.207.23) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Mon, 11 Jun 2018 01:14:33 -0500 Received: from ex13-ell-cr-11.home.ku.edu ([::1]) by ex13-ell-cr-11.home.ku.edu ([::1]) with mapi id 15.00.1293.006; Mon, 11 Jun 2018 01:14:33 -0500 To: Rowan Collins , "internals@lists.php.net" Thread-Topic: [PHP-DEV] [VOTE] Make compact function reports undefined passed variables Thread-Index: AQHUAUtnmjqQyOhJUUyldVNibOOm9g== Date: Mon, 11 Jun 2018 06:14:33 +0000 Message-ID: <1528697673100.21360@ku.edu> References: <1528656103200.14318@ku.edu>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [129.237.14.19] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:129.237.207.23;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10019020)(396003)(39380400002)(346002)(376002)(39860400002)(2980300002)(438002)(52314003)(189003)(199004)(336012)(2906002)(6116002)(3846002)(5660300001)(2616005)(106466001)(476003)(93886005)(2501003)(7736002)(7596002)(446003)(5250100002)(75432002)(2900100001)(186003)(117636001)(26005)(426003)(126002)(11346002)(786003)(110136005)(316002)(356003)(486006)(106002)(36756003)(7696005)(8746002)(6306002)(47776003)(298455003)(53546011)(88552002)(102836004)(59450400001)(66066001)(8936002)(229853002)(8676002)(50466002)(39060400002)(86362001)(246002)(966005)(6246003)(97876018)(478600001)(76176011)(23756003);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR0101MB1614;H:ex13-ell-cr-13.home.ku.edu;FPR:;SPF:Pass;LANG:en;PTR:ex13-ell-cr-13.home.ku.edu;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD027;1:+F6ULdIbXQoC6qYggqwDiHdGxV0t6KFU78tGGPUGv6/Bk1Vzvu8msHFFttctedYzRen1HCQP8Ny8CCwsh8yWXlhGGNjrNx4yEcw5YtIK+drMkoPIDJcy80ZH7nMuvMif X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:SN1PR0101MB1614; X-Microsoft-Exchange-Diagnostics: 1;SN1PR0101MB1614;3:BwFTvpodnIDXz36paS0jUzUTBvB53yhnSlZtSnURoBkcbixUXd+zzvPhvW385GNFFB4MPIGErKsWYvzArK+yzsIeDhToUBafDf0Ew6UlYnGUNo/jLbj8fgwN49bKyPP5qkH5GxxCuXe+AMQnqtiDNNIh0lbpBe1YGRflzScVP5skiU/zFa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zb2a+Y3pWB6bGYZbcb1LIbTdRa1UdtA/0CHFipDDp0XF/vZvgVpkKmyS2GV6m1GLmlkgiKGLZ9JiXkNNtadxL85Tfxvn8ySdQKVkKk1uJR19uh2gcdYhn+unGcNO/JPIRcYUOcW58+2tC5p7G/mUxZ/zbOYT6Eo+flisVgqxU4AejZb3+GIXiGzrGFHKxnoGcxazjmnea8mfQZtAJpq6V6Kxufo0O3ODg3x5Jdi2ByfZi7g5Cx8/kp92TBT6ur2euVCwm+xwCFrJ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506)(131327999870524)(4782527817362)(17755550239193); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(3002001)(93006095)(93004095)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281529075)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:SN1PR0101MB1614;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0101MB1614; X-Microsoft-Exchange-Diagnostics: 1;SN1PR0101MB1614;4:0SO8TITYTDL83alD9gibxEHo6xGTaz89LThNMA+uR6NA6aUFEo3GYINWoWjfnO9ZrZ1/Tn1d4W1eZ6216WeVB5HoCuVKThkwH22m8/h2CiEvta/neafVg+9pi0froUSiQ2hQzvPbb9F7l9R91F8O6Az1VCPoG4SLQ3/jgDIXHQoNrGTKoO1VqAQzXLSCXeEebq6j9US6znrWj8XM3KmQcYSkVqwV2oam4JlMxfOM7p0y2/yGQETjAKNbQklmH9Ua+WYDDL3ZHqTwOJRaZC1u50SXDTj0FKEfTtCLxtSV03NkNCAo5ne1fif1EHrsc48QVW+/jM54JNEtdnTSwkBaLKemsoi3ew+5giQZAPktxJOlMEeKhOmAa0m3kJMIaotbxNI9PVKt1tbIslXuNWTTC5FcV8wA+KaoOxTfx+JoW+Q= X-Forefront-PRVS: 070092A9D3 X-Microsoft-Exchange-Diagnostics: =?iso-8859-1?Q?1;SN1PR0101MB1614;23:K7Usz3csXA6tFPy5/obGKjCZhKquDMCLgnL9I?= =?iso-8859-1?Q?ASaynFqpM8923lNZWBtGHgZp2Gw4DvNPfY145oJBnxn/Dt3k67SUM/eviH?= =?iso-8859-1?Q?sJJsZyyf24WE0Fo/S2T/f+VowDbtMtFXZW+fhl25x396CgM3sbuJFFnFz/?= =?iso-8859-1?Q?pT3uvcMRmRtQ3OfkI5JVQ57V8U8wGFiNAAiVG2p7YVB0iwCmqlU49LP9Em?= =?iso-8859-1?Q?SkUndTkCYw/LFizQNd//n839f9JrVPuQFTe/icwfBtbWWCcxArWdocuIzj?= =?iso-8859-1?Q?TW0AOrPx2vUF3tIheAVp1NbCLQ8M/9IBPlJxvQcsSATQI3q1VIFDd8DT7a?= =?iso-8859-1?Q?e5dIyQIjREfr1mM4lMxzdp7t5Mmay6fLMHDxfVsEI/3aCmIFDKtZpV8AeC?= =?iso-8859-1?Q?ixjgHqiNSUzPQhqID29iGK4T/YGbfdCaONJ6qADHKGCWf3rAjLCdw48iWo?= =?iso-8859-1?Q?vh736SeI4QeuUd2kl8OGuoQNBFNd6jA5DJxc4Mb0gioO1866GxRvGf3JkK?= =?iso-8859-1?Q?cZaiCcZJzV1J1CGog+9h2W8Wbwa0hK9bPJMV/vSDhYJfbmPvgIkxa5gMeQ?= =?iso-8859-1?Q?F/Z6I8Qg31+fZT65dXZdRcSasaOuy2pzR7k/ZNVTT4Zca43xhg963X9dAz?= =?iso-8859-1?Q?Wwmh1A71L46KcBll1X/fSMBj4WhkK5GD18QvgN4NHRRGhQAbdp3+Y739l4?= =?iso-8859-1?Q?MNKZdtjQs2a+Fdmq7b0IeIRapj0O6RrGpMPE5qKvrrS7jgH4hOhOIRrYjw?= =?iso-8859-1?Q?kIDfMtvq2Vyx1G7A7C8WKYmCeDTltN1ux71h9vQh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nY63Z2xtR0CuPpoobAhU4XV+4H7guaa+Qp0KFGaSXP5aKTk4e526zo/Z2vwKrM8zrxp00HoYjGa8ktyRvaxj24AauEjspJRMuciTuPRmxLs124WAyamz1AXNPi/GFCRzfy7PVgLAJonaJNf4jebkuTrtmHPr0T1iU/5RLyNmk5tDERoiYUpzvq/DMdV8ms6B23MPHWM7N4+6TkkkGAT9OM0Zx9cSKV7JhDt3WVTF43n1Ic1DLb4Ma37B/xnGcbqox40VBB+7p4HKMPYQpi8uQExUoOK6rAABoIUwmYtz7D9Z/L+zTg1tjEQMZenlJo82nTmroWIurFikl0hC6MoF+rSxswITFUxCd+jLI3e6MS+vQS9NLCd2vzsyoMkkUow2EMdLQ54l614WNWk/704gPEokUAIbjuEYQjo05EZPuAJ4Qz6j2qufKPtG6drFA==;5:5WAVyyIfM6wdkToivSmtqg7zbCdqJUCmN8UvCPL8Z5anELfuOg10RnqFcNOc8pfxaas3YiLCSphfOuosMTI4IEN25M+c8dvrHUyCHYx5vHsvY0/35v0nE/p9EfLnge+D5UaF7YQ+qJyhARng7KKlxFuu99Iwm8lsC3BCC98FQlY=;24:Nmuuc/iWqmzh4YwlfL7I7hNBcFIbxPh1mDdDifdKavWnCOiKgNcidn9awxBt2gO889QDccAPcMhUkR6ejCBmH+/JPVOhm4kKNPrvwSMOuvQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR0101MB1614;7:erh4s8oJHLXoU4ZufyjWpRwUJuwfLQ1LmF8++kKMCuu2OYhhXN0iFjHlWmRq1nn+4fkBQopPQ+MlrSsm9X11fE9Y0p+hPNgKBXVz4iiHu59j2QeuBsJUnQ7nxny3nXws7CcefgzJ2TwYNZN06JTltBi7K6JCZT+sq0TSjmyF1YN8khG+YqHczkX5PB6fnYqmMWFnk6pweYI1U3Ig6FBDJv3yN5zRIBkbaBybxHNPhevMSV2IYT0oYlbOzsGXeyH9 X-MS-Office365-Filtering-Correlation-Id: 66326275-ed81-4cc9-6b22-08d5cf629a0b X-OriginatorOrg: ku.edu X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2018 06:14:33.9729 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66326275-ed81-4cc9-6b22-08d5cf629a0b X-MS-Exchange-CrossTenant-Id: 3c176536-afe6-43f5-b966-36feabbe3c1a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3c176536-afe6-43f5-b966-36feabbe3c1a;Ip=[129.237.207.23];Helo=[ex13-ell-cr-13.home.ku.edu] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0101MB1614 Subject: Re: [PHP-DEV] [VOTE] Make compact function reports undefined passed variables From: zrhoffman@ku.edu ("Hoffman, Zachary Robert") On Sun, 2018-06-10 at 23:49 +0100, Rowan Collins wrote:=0A= > On 10/06/2018 19:41, Hoffman, Zachary Robert wrote:=0A= > > Deprecating compact() would hurt workflows where you use the same=0A= > > variable names=0A= > > several times in different contexts, even though they are only=0A= > > declared locally=0A= > > for the purposes of compact() itself.=0A= > =0A= > I am not convinced that building logic around variable names is ever=0A= > a =0A= > good thing. Variable names are primarily a label used by the=0A= > programmer =0A= > to write source code, and in my opinion that's all they should ever=0A= > be. =0A= > Programmers should be free to rename them within their scope, and =0A= > compilers should be free to erase them when optimising a production=0A= > build.=0A= =0A= That is fair, I can see the merit in that.=0A= =0A= > > public function c()=0A= > > {=0A= > > $d =3D $this->d();=0A= > > $a =3D pow($d, $d + 1);=0A= > > $c =3D $a ^ 0b1100;=0A= > > $b =3D $a - $d;=0A= > > =0A= > > return new B(=0A= > > compact(=0A= > > $this->b()=0A= > > )=0A= > > );=0A= > > }=0A= > =0A= > Your two classes here are clearly collaborating on the processing of =0A= > some specific collection of values, which have something in common=0A= > with =0A= > each other; they are not really passing 4 variables, but some=0A= > structure =0A= > which has 4 fields. It might be nice in some cases if that could be=0A= > a =0A= > by-value "struct" type, but the most appropriate in current PHP would=0A= > be =0A= > to define a third class and pass an instance of that from class A to =0A= > class B.=0A= =0A= It is true that, in the example I gave, it would make more sense to just pa= ss the array itself, or some other structure. However, the end goal is diff= erent. Read on for details.=0A= =0A= However, even if those 4 values end up being stored in a structure, I don't= want to manipulate that structure within that class method itself, I want = to perform computations with local variables. If I have to separately store= those variables to the structure at the end of the method, that is fine.= =0A= =0A= > =0A= > =0A= > > foreach (A::b() as $b) {=0A= > > echo $a->a($b) . PHP_EOL;=0A= > > }=0A= > =0A= > This is a poor example, because if this was really the end result,=0A= > then =0A= > the two classes aren't even using the data with the same meaning,=0A= > and =0A= > class A might as well return a plain array - if the keys are no=0A= > longer =0A= > important, it could simply return [$a, $b, $c, $d].=0A= =0A= You're right, that is a poor example. In my project where I do something li= ke that, that is the first of several steps in sending an email from the La= ravel framework (artisan command -> event -> listener -> mailable). The key= /value array ends up being re-associated at a later step and passed into a = view, where the array is extracted (each array key becomes a variable with = the same name).=0A= =0A= I did not think to include the other steps because I was trying to keep the= discussion away from any framework in particular, but now that I'm thinkin= g about it, Laravel views is my only use case for `compact()` in the first = place.=0A= =0A= I end up using `compact()` in the same way when rendering Blade views from = Laravel controllers, which is easier to demonstrate, so I made a small Lara= vel project to demonstrate `compact()` being useful. It is viewable at http= s://gitlab.com/zrhoffman/compact-example . The project only consists of 2 s= hort files (which are copied into a Laravel base install), which I will pas= te here anyway.=0A= =0A= First is the Laravel route to the base URL:=0A= =0A= Route::get('', function () {=0A= $base =3D 2;=0A= $power =3D pow($base, $base + 1);=0A= $xor =3D $power ^ 0b1100;=0A= $sum =3D $xor + $base;=0A= =0A= return view('index', compact([=0A= 'power',=0A= 'sum',=0A= 'xor',=0A= 'base',=0A= ]));=0A= });=0A= =0A= And after that is the Blade view, which renders the variables in a non-iter= ative way, meaning that storing them in an array would not actually help us= .=0A= =0A= =0A= getLocale() }}">=0A= =0A=

{{ $base }}{{ $base }} + 1 ^ 0b1100 + {{ $base }}=0A= =3D {{ $power }} ^ 0b1100 + {{ $base }}=0A= =3D {{ $xor }} + {{ $base }}=0A= =3D {{ $sum }}

=0A= =0A= =0A= I included a small installer script in the project in case you want to see = it rendered, but you can probably get the general idea just by looking at i= t. Hopefully, this demonstrates that, for the purposes of the view itself, = there is no advantage to storing all of these values in a single structure.= =0A= =0A= > =0A= > =0A= > > The alternative would be manipulating array elements directly, like=0A= > > this:=0A= > > =0A= > > public function c()=0A= > > {=0A= > > $e['d'] =3D $this->d();=0A= > > $e['a'] =3D pow($e['d'], $e['d'] + 1);=0A= > > $e['c'] =3D $e['a'] ^ 0b1100;=0A= > > $e['b'] =3D $e['a'] - $e['d'];=0A= > > =0A= > > return new B($e);=0A= > > }=0A= > > =0A= > > That is far more cumbersome.=0A= > =0A= > I agree that this is slightly harder to read (and the version I=0A= > would =0A= > prefer where $e was an object rather than an array would look=0A= > similar). =0A= > However, this feels like an argument for some syntactic sugar, like=0A= > the =0A= > "with" block found in some languages:=0A= > =0A= > with($e) {=0A= > // Inside this block $a is actually compiled to mean $e->a=0A= > }=0A= > =0A= > Not that this can be entirely de-sugared by a compiler or static =0A= > analysis tool, so can be completely ignored by optimisation, and =0A= > reliably processed by code inspection and refactoring aids. This=0A= > isn't =0A= > true of compact(), variable-variables, etc, because by exchanging =0A= > strings and variable names you are writing fundamentally dynamic=0A= > code.=0A= =0A= The other reason I mentioned Laravel is that storing variables by key in an= array and extracting them later is intrinsic to Laravel's process for rend= ering views, and writing "fundamentally dynamic code" is pretty much inesca= pable in this case.=0A= =0A= We could still avoid it on our end by rewriting the return statement of the= Laravel route to this:=0A= =0A= return view('index', [=0A= 'power' =3D> $power,=0A= 'sum' =3D> $sum,=0A= 'xor' =3D> $xor,=0A= 'base' =3D> $base,=0A= ]);=0A= =0A= Since I am necessarily expecting those variable names on the other side any= way, this seems like extra effort worth avoiding.=0A= =0A= Cheers,=0A= =0A= --=0A= Zach Hoffman=