Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110840 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 64234 invoked from network); 3 Jul 2020 18:02:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jul 2020 18:02:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 799D41804F4 for ; Fri, 3 Jul 2020 09:52:04 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8075 40.80.0.0/12 X-Spam-Virus: No X-Envelope-From: Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-oln040092011020.outbound.protection.outlook.com [40.92.11.20]) (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 ; Fri, 3 Jul 2020 09:52:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XkitmBQOiO8VcnvHzTOYzLtPn5+y8QesDZcPODpjXq7ku4+P6ONJUhhFYbHKHkwvn1fFzwVvkOabTWgjcqfC5fFilUfT9Xe157syE7JrcihXxtHCVgeFJ2p8TBto/FtdeGqeRwwqGxHqxzkJ2/1eDQiQ4NiAFNW+YL0YTDQ/JRlav9HgSUYpkkAG8UWG/aUT09fZe+sE1SXkhMc0gyzFfky1AFC+kxlIndDl9Ym5p90CfTBjLS6RugKlps8FiOeSb6xFczHVrZC/yhTdVYcuFnMc3HE8ZYqiz7NSXzs/FWnNNXDjmZF2CCA/KCs9jApNtqByZ5+FgPDf7LumFHPeFw== 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=fO6l7Ppp4K/Jxyq5GnB5HroOW1GABgzCqXcvzmIOZkI=; b=DUR+c9TTuOHTxu5q+yQzDvZOZFL3KWnyw0tVgLSrdo5arh4JM/Jqul3ElynnmH/s0In/pVby+Nt6fGyayA83ezs46laXepcosY3M8JfAKfM/vp3pOaBpW7+7r2VXs1HLR1npMncj6vCE/X8rpt5mGWQyV810XwTeYNKaet7YxXVDKBp9XHbp0MNjw5nHuDGXCyO6QkMGx7IuwmMSHHNu+nuIs5CL4qFBavLyvbKlJuFAKSc8TaBAx4LMWq+P2ZZI9oathPE2J6RVumDxvICbAqthQrEuCNTSr5SusPkFEE+8sIWyExMqx0ynVfbiz7V/5MYYE60ZcJrQ4/JA23DTRA== 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=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fO6l7Ppp4K/Jxyq5GnB5HroOW1GABgzCqXcvzmIOZkI=; b=K+kfXsnl3ouW+pRncoeX1/4hWPMroVm1ORNqfOHfveQ9pbrIomQTh3v9gpo8uBqJajrU2cBhuYQuQ1kHIZAdSs3rDetO/FS8X6EPR291/YtbG9wRtfFh7dT5VOQ9dOrInkjmDNELQ1KSZhml1ajgg1a5NLsEzYMNO5fhuDYbWbndCkcIeFy/t8nbQNrYbbB5se867J/8d2zTqeyP6HOVEVxYe7uG/KfteMoFFLCX0dHpWFN5EgF22YLD7T2jRtswbg3QffbyXbCGnP+V87ViLINxzb4ixWZqJ+ZBbd27A4kASVAoSdRjWneP1rswyYIcWFvfNJHmcyezQ9sk8La1jw== Received: from SN1NAM04FT048.eop-NAM04.prod.protection.outlook.com (10.152.88.58) by SN1NAM04HT052.eop-NAM04.prod.protection.outlook.com (10.152.89.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20; Fri, 3 Jul 2020 16:52:02 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com (2a01:111:e400:7e4c::45) by SN1NAM04FT048.mail.protection.outlook.com (2a01:111:e400:7e4c::451) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Fri, 3 Jul 2020 16:52:02 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::54e2:1eeb:fc5d:8c21]) by BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::54e2:1eeb:fc5d:8c21%3]) with mapi id 15.20.3174.012; Fri, 3 Jul 2020 16:52:02 +0000 To: Benas IML , PHP Internals List Thread-Topic: [PHP-DEV] [RFC] [VOTE] Make constructors and destructors return void Thread-Index: AQHWULV7dKXBUq42GUWHL4FwYaiwzaj2EvbB Date: Fri, 3 Jul 2020 16:52:02 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:DB00FCB6854F86BE2F734A505223E51A9512DF6D5022C08AE8BBBB606A1EE869;UpperCasedChecksum:C6BC414D4CCBD52835AD9C5ABB39E9B8C65722EB7C7D3B8A8130D772A1EAF2B3;SizeAsReceived:6980;Count:44 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [6x3fB9G3BmhoqUFXCVi3SWKVeILRvz6o] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: d0a62eae-5dc9-4020-09c6-08d81f7168d1 x-ms-traffictypediagnostic: SN1NAM04HT052: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: F17CRTiSP5lEYUfo5kccI7w4DsVSPsJKFTcTd4i5OkBngUFVwBS2UWn+SkSluJNtI9aTwFrb4u2yOm2gHQ9OPmXYZJIG+m8rp38aRAiLa+BezcSx6DtT6wtZ5mS6hGGWZYm+1o3QbyiuSHV06jjSJdQFvaIVrZU6YKJI7Kk6Xa8crHdV0fqkhrObFBpSLE76a/qah92PdBWgzDvo0FYkyJ+6ldKLSeGeC4Y2Jr2nHYrtlEQY7i7kUuUaSwxvPBUT x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR05MB6535.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; x-ms-exchange-antispam-messagedata: ilJM0vK+/PsU678t6PZe29ifHKA7YHTRAs+pwQGhH0pRRlwLJiaRxp8rchdbxXB97cY8EAPFnmKfjFBnVek9ZBaBeZm84FosyAhn3JyCKB4FON6dWj6tObB+GFqzJaVrSfa1qjbmMweTY7MJJCCYeA== 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: outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: SN1NAM04FT048.eop-NAM04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: d0a62eae-5dc9-4020-09c6-08d81f7168d1 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jul 2020 16:52:02.2121 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM04HT052 Subject: Re: [PHP-DEV] [RFC] [VOTE] Make constructors and destructors return void From: theodorejb@outlook.com (Theodore Brown) On Thu, July 2, 2020 at 4:12 PM Benas IML wrote= :=0A= =0A= > I have opened the voting for the RFC, let's hope everything is going=0A= > to be smooth :). If you have any other questions, let me know!=0A= > =0A= > RFC: https://wiki.php.net/rfc/make_ctor_ret_void=0A= =0A= Hi Benas,=0A= =0A= Thanks for your work on this. I'm in favor of deprecating the ability=0A= to return values from constructors and destructors to align their=0A= behavior with the documentation and how most other languages work.=0A= =0A= Unfortunately, the RFC doesn't provide an option to vote just for=0A= this. Instead it only offers combining the deprecation with a new=0A= option for developers to choose whether constructors and destructors=0A= are explicitly typed as void.=0A= =0A= But what will be the benefit of typing constructors/destructors as=0A= void when this is the only allowed type, and after the deprecation=0A= adding the type won't change anything anyway? It will lead to a=0A= situation where some projects require the explicit type, others=0A= require not having an explicit type, and the rest have a mishmash of=0A= the two. This will lead to further bikeshedding in projects and=0A= unnecessary code changes.=0A= =0A= Allowing an explicit void type on constructors is also at variance=0A= with other languages. For example, TypeScript does not allow=0A= constructor return type declarations. [1] Nor does C# [2], nor does=0A= Java. [3] Likewise, C++ constructors do not allow an explicit return=0A= type [4], nor do initializers in Swift [5] and Kotlin [6].=0A= =0A= For these two reasons, I voted no on this RFC. I think it would be=0A= fine to deprecate the ability to return values from constructors/=0A= destructors, though, and this could happen in PHP 8.1 if there isn't=0A= time for it to land in PHP 8.0.=0A= =0A= Best regards, =0A= Theodore=0A= =0A= [1]: https://www.typescriptlang.org/play/?target=3D7&module=3D5#code/MYGwhg= zhAEBiD29oG8BQ0PWPAdhALgE4Cuw+8hAFAJQBc0AbvAJYAmK6mAvqj0A=0A= [2]: https://www.c-sharpcorner.com/article/different-types-of-constructor-i= n-c-sharp/=0A= [3]: https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html= =0A= [4]: https://docs.microsoft.com/en-us/cpp/cpp/constructors-cpp?view=3Dvs-20= 19=0A= [5]: https://docs.swift.org/swift-book/LanguageGuide/Initialization.html=0A= [6]: https://kotlinlang.org/docs/reference/classes.html#constructors=0A=