Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108832 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 17059 invoked from network); 3 Mar 2020 20:14:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Mar 2020 20:14:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 348371804D8 for ; Tue, 3 Mar 2020 10:34:03 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8075 40.64.0.0/10 X-Spam-Virus: No X-Envelope-From: Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2047.outbound.protection.outlook.com [40.92.18.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 3 Mar 2020 10:34:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mHEZ/Sn9yWgtoc0ZFirx0U3c4hWRwJe5reWzZhXIEY+csOy0lKQyntsnLJP73BEw0lsDYn1UWMMFqi6V7dQXCuyMZsMm7L6RtIMXwagBAdByy1Dh+NbM2B/yZXBPucYs1L6ua7acCDyogc/zRE+L97RVnQ/TSuC7YotZmOnU3955f1RiASo5Jo2wIrWrm9c+1BB3LWIoCDsqAArx4DC57C+9wSLcC02cdrLcEP+upx+kLcm+b3+6hD2Bnd8M4yeVHeREFMifPIt7dMmjoJaNuPMrrEgIbZAY7a4pCj/TPzfX5yMdKg9iyDmyEbxVrwHLzoY/odm4nxfRKMupAVxjEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hQEOFbQMYT2kMcBmfkG+LaRqnnscHC9KXTiibN1Q45o=; b=TXzW+p81dhdIw0Z3ie3ZFXTX8tsYSkDMNNylWA7gdFRyUpqKai599ogQB60YXGiE+PywVddwC7LOoA6G1PW0yyKNoee1wj0oP1BtXm9Fdof9Gl48YgZ6uHT6h3lE7lvMMTpSL29GUQQXKqSw43g9z3Di9nXruHlXv5MUFAQcvkcbFYiuxVrXBO7OyAJADSzEBjoL4zcCy6XqAQZpMKr2+F6t9RfA7ImgpJxFjZzResuqrXB/XHmiuUEDEjuzc/AeCVl9C+/yrllByucPjBVUVSiKpmAszQ3g+IFMVt4E5IdJ5gXFxjxTiaThHBKOIiDQwUuM4L2wbckmTUOgj4HFAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hQEOFbQMYT2kMcBmfkG+LaRqnnscHC9KXTiibN1Q45o=; b=OB0OihG3T6DVtvD29BIF4xBkzPJBu3jHdMfJ9j2vkTqChvo2dkyLQuOQpPOpyM8Ihr7h4p8XD9Xbge3gfY/SE9Oc2RLo3FMbvpmLW31hpuaE3gvxiTMF4uS3jsG+IeQvY6SeDk0xtc/eXYs0scBy+e5sRk234zzSosl31uU14Y9BqqVpDXl5ZaAhimmOZHqAXgYUOBOMsJS/d+6xG7TqNm/UzKpB9YST4LG8wzIX/BxED7JZGTypXEJk4hCsMHhzikXhsnIHnoVOMQy4DfRckXH6TXPkEz2U9LdZ0m8SbPoTZ/fSbBcKckPCIBKBp4Hcc+WuX6qW0yrT+9M5HmlPIQ== Received: from DM6NAM11FT016.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::39) by DM6NAM11HT108.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::485) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.15; Tue, 3 Mar 2020 18:34:00 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com (2a01:111:e400:fc4d::36) by DM6NAM11FT016.mail.protection.outlook.com (2a01:111:e400:fc4d::395) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14 via Frontend Transport; Tue, 3 Mar 2020 18:34:00 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com ([fe80::1133:bcac:caf1:d588]) by DM5PR07MB3067.namprd07.prod.outlook.com ([fe80::1133:bcac:caf1:d588%3]) with mapi id 15.20.2772.019; Tue, 3 Mar 2020 18:34:00 +0000 To: Nikita Popov CC: "internals@lists.php.net" Thread-Topic: [PHP-DEV] Straw poll: Places to allow function calls in constant expressions Thread-Index: AQHV5TVGaQlwvBZF+k68DGwMXa9nx6g3Eo2AgAAowno= Date: Tue, 3 Mar 2020 18:34:00 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:69E01D08980DE3B8FDFE0715DCFA190A3606D3A2E70DA61E38E27F9CF57F76D3;UpperCasedChecksum:E395C0BF19A94C923C0CB4F36A4C880E34E2111D5ECD6CAF68420BD42EABDF62;SizeAsReceived:7280;Count:46 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [uAxUBw+7QPIO/4p4FrJKCtr+OhMpEcMJl3SCFyOGXgstr4KVapcXlOvjS3kQCmvB] x-ms-publictraffictype: Email x-incomingheadercount: 46 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 785d5cb1-9ef2-447f-0e91-08d7bfa17127 x-ms-traffictypediagnostic: DM6NAM11HT108: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0drXUloVM+sNIuxwOK/Xt8E5honsgkl2Ozlk54N+Xue6kiSeu1RJFz7pUKNZUNYlim5XAy3UIanUgMUn5u3i/LWK2upoeEtbsaNDlFqV2VHAk2FgJ7YKzDiAALztaSeu5TnTLIBQ3J9uZDMfKAEt+54npKUw/y6x5dcfM2PTk7liMe699Bc6lWpvOQW6urCnkYpFUXQ45KRatS9/t5u8Pcicl+VG+J5IeYtljuUqJtA= x-ms-exchange-antispam-messagedata: 1WgVzTBR2iZeNKrm1YmPyq3eNCdVUFQq2pHieRzIzckN9TpMjjTfvBdfv0xWU1i8F3eL++LC4nIkuyOQio7E3DkqSrzXfcpLCgD/9CUUjBQM59K5gceAAJe00rWZNJa4oCT2G8yF2STWPw3ATegS/uTQrE7ClDOCfhRBf/QvbUVFtrIMxwW8c/O1lE7thdkQWKGuyGinaj+eEeX/hPqWMA== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 785d5cb1-9ef2-447f-0e91-08d7bfa17127 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2020 18:34:00.4869 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM11HT108 Subject: Re: [PHP-DEV] Straw poll: Places to allow function calls in constant expressions From: tysonandre775@hotmail.com (tyson andre) > I feel like the results of this poll aren't going to be particularly=0A= > meaningful, because it gets too caught up in the details and loses track = of=0A= > the big picture.=0A= =0A= I'd definitely agree. If I was writing the RFC for calls in constant expres= sions again,=0A= I'd focus more on adding concrete examples of where function calls/other ex= pressions would make code easier to understand,=0A= rather than focusing on implementation details.=0A= At the time of writing the RFC, I thought a major objection would be whethe= r or not it was actually feasible to implement,=0A= and many people would be familiar with use cases where function calls in ex= pressions would have made code more straightforward.=0A= =0A= > If you ask people whether they want to allow=0A= >=0A= > function test($param =3D some_call()) {=0A= > }=0A= >=0A= > they're going to to tell you "no", because that seems pretty esoteric and= =0A= > most people likely do not see a use-case for it.=0A= >=0A= > If you ask the same people whether they want to write=0A= >=0A= > function test(Dep $optionalDep =3D new Dep()) {=0A= > }=0A= >=0A= > instead of=0A= >=0A= > function test(Dep $optionalDep =3D null) {=0A= > if ($optionalDep =3D=3D=3D null) {=0A= > $optionalDep =3D new Dep();=0A= > }=0A= > }=0A= > a lot of them are probably going to tell you "yes" now. The question didn= 't=0A= > really change (new Dep is just a different type of "function call"), but= =0A= > the perception changes a lot.=0A= =0A= Good example, I hadn't thought of mentioning `new` as an example for the "a= s many expression types as possible".=0A= That also lets functions clearly enforce arguments are non-null.=0A= =0A= > This is also why I think the focus on plain function calls in particular = is=0A= > somewhat detrimental. This is one of the cases where going for a paradigm= =0A= > shift (constant expression -> any expression) is "simpler" than doing an= =0A= > incremental change (extending constant expressions to allow function call= s,=0A= > and all the subtleties that entails.)=0A= =0A= The point of https://wiki.php.net/rfc/calls_in_constant_expressions_poll wa= s to measure interest in "any expression",=0A= but did a poor job of mentioning arguments in favor of it or how it'd simpl= ify common examples.=0A= With better arguments and examples, though, I'm still not certain if it'd b= e a 2/3 majority for any option.=0A= =0A= A straw poll or RFC arguing *only* in favor of a paradigm shift with better= arguments and examples=0A= might see different results.=0A= =0A= - Tyson=