Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110943 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 47493 invoked from network); 11 Jul 2020 16:04:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Jul 2020 16:04:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8B4491804E6 for ; Sat, 11 Jul 2020 07:55:48 -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=-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,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-oln040092003067.outbound.protection.outlook.com [40.92.3.67]) (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 ; Sat, 11 Jul 2020 07:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aPqSSq3DqcaKH5D0nJmtT3vK+Hl/2hzRlYyiQkok2He1omRVVmylompfPLLJ69HIlwzYzWMo2pQx/zlXUujFwpY1nf7xhUIzEmAuoyIw3AFN+4D9dbfzyM2DnnlDxOoBIJ7/Psb84tG472V4cbVX/DjA0VUDgNIl+ASQ31pQNUPOO0QHxKtriRgcMf3tXy2e2ptjKChbmkNkwAJrZsveem7wqo8qUL5cxfM2A5eeAiXCI0rPkegHkDmfyibZRDN2KXhEf/XD//Dtisk2C0W78L8UPFqQKMRYrqkSQpvKAg7Jrud7g9GJlwuusP8qkgdMmWhMA9qiCwwEqNhRnJi8Ow== 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=VP7MBBTSCWefU4quDXbKXdZGPD01QLNuLZA2J6AlRPo=; b=CEIkvi58LQb1T1AFJsMsUAvcjuvVAhc7D8wEI1myN+GgRXm6W7F9mk3cmkkhEWZhxqb2HgM4SRZLr15rKh7rF3DNtMhhlCf5cIeTNp9RsRzHHBTkfihu354iB5o6t0WK4RAjNJ03HyuzseU4Q6G1sRRLeXHc/spcIn3rF7MiOZkpSVmYk2WVpmmVb/JIOTpRe9DvZ0SF0n/50Ih1B4+idz6hUaPRwCp29szY2lrhut0gqGVWJpihczBeMsNVaMLcvKkCkVJ1xyJ2h+9DLxTFsPewC4iq79oQF7KPoPabpSB18TaJ1KkqmqicT7klEuOfHMVYIhpKQkpOvl6lg4MIAw== 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=VP7MBBTSCWefU4quDXbKXdZGPD01QLNuLZA2J6AlRPo=; b=RP0LbH2js2zK8Owd6c+iKB7e7klK70CZl7qncffrGAnoxMyMsNWRjZpdqXnC1o/u+0kKJvYiCk6RE6uE39iF57WPpCRD3DJMdcT37CY4PvrOZ1OTtqyKxZnt0CTNWSQmQBCjlrv7hBNbVHptLxgg9MsUEPMJ9vYUcjO399XrWfusNQIQO9x857J0FRwPXp8xQT0VNrddnXlyFUCOhR3BPyB5JxwgZxmzFZUPif7l/8nd6/JQof+NayR5L+uHIkcQMbB1vc4jKtfIQNq7kIcZQYtCH6tpmA68Gbuo8m20sCGw+USg/Tw5O38DRUzFJcUmteFs7A49d/UF54KHuo09tw== Received: from SN1NAM02FT057.eop-nam02.prod.protection.outlook.com (10.152.72.54) by SN1NAM02HT100.eop-nam02.prod.protection.outlook.com (10.152.72.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21; Sat, 11 Jul 2020 14:55:46 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com (2a01:111:e400:7e44::4c) by SN1NAM02FT057.mail.protection.outlook.com (2a01:111:e400:7e44::361) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21 via Frontend Transport; Sat, 11 Jul 2020 14:55:46 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::f0c8:f413:c7c1:e934]) by DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::f0c8:f413:c7c1:e934%4]) with mapi id 15.20.3174.025; Sat, 11 Jul 2020 14:55:46 +0000 To: =?iso-8859-1?Q?Olle_H=E4rstedt?= , Chuck Adams CC: PHP internals Thread-Topic: [PHP-DEV] Possible RFC: UniqueInterface that throws exception at refcount > 1 Thread-Index: AQHWV4x7jXS7o3BhLEGSRfZHduTrhqkCcEqAgAACxICAAAFECw== Date: Sat, 11 Jul 2020 14:55:46 +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:9F4DB8475109C67EA5FE7BEA63BDBAE25964CBDB4A003B7F2B12AAE9354E2BF6;UpperCasedChecksum:737064D435CB8F36F23A04576A1844A43A0645DC0654B3746ED597D3665A7C82;SizeAsReceived:7200;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [+1XE5nCXHjFfuFju7plrNCpeS1aMOTso] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 36b60a0a-872e-44a1-53a3-08d825aa7e64 x-ms-traffictypediagnostic: SN1NAM02HT100: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: zRKWJXrwMuBpsMO+MtCdSrBmpd2UCp+JpTh7F13Pj617g3qpyYJiSbUBL80hQkkVec7YOH7Np5ywWRm1gIlFe+T68dxpCRH4MvtBceXDJtZJvbfw2BPXkiu3yc3Sjo8SJe16j3i6VqsehSBf2ecmZmAs34uFtKM0Senv32MeAPxvcgs1xjLogsFVcNn+XtFEuQZGU0aar/CuLo4sw25kkA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR07MB6618.namprd07.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; x-ms-exchange-antispam-messagedata: kUjKndWxqbbjhwgjU2PYoMaztVwPEmkE3ssFQE9lFIgRmMIwG0NkKBXO5yR+QJLNL8/jd99+IStBGsLRcUpEoO5bwJG2VSMOwOeiemC8SdmEbhwgR2sHz291MkMW4SXh3J69gzM3Pcxo+2RumMalLQ== 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-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT057.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 36b60a0a-872e-44a1-53a3-08d825aa7e64 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jul 2020 14:55:46.7397 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM02HT100 Subject: Re: [PHP-DEV] Possible RFC: UniqueInterface that throws exception at refcount > 1 From: tysonandre775@hotmail.com (tyson andre) > Yes, it would be a dynamic uniqueness system, kind of.=0A= > =0A= > Another more flexible alternative would be to add magic methods at=0A= > refcount =3D 1 and refcount > 1, possibly __owned() and __shared(int=0A= > $refcount), for classes that implement a TrackReferencesInterface or=0A= > similar. But this would need to do ~0 performance hit if not used,=0A= > don't know if possible.=0A= =0A= Then again, php already calls __destruct if it exists when the refcount goe= s to 0,=0A= so I may be overestimating the potential performance impact.=0A= =0A= There's a lot of edge cases - probably way more than I mention here.=0A= Running into those edge cases, you might find the feature unsatisfactory if= it were to be implemented.=0A= =0A= For example,=0A= - The UniqueReferenceException itself creates a trace, that increments refe= rence counts, which might itself cause a UniqueReferenceException.=0A= Workarounds for that would probably involve allowing multiple objects to = reference a UniqueInterface, and then it would be a weaker guarantee.=0A= - unserialize() keeps extra references to ensure that it can delete the cre= ated objects if the original references were overwritten. __wakeup() and __= unserialize()=0A= - The reference count is incremented when calling __destruct(), I think.=0A= =0A= ```=0A= someUtilMethod();=0A= ```=0A= =0A= - Tyson=