Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110941 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 42110 invoked from network); 11 Jul 2020 15:40:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Jul 2020 15:40:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 56E0D18053E for ; Sat, 11 Jul 2020 07:32:02 -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 NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2085.outbound.protection.outlook.com [40.92.18.85]) (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:32:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C6Ob0xGb3/GHUedJ8MFP5XJM3id3hNguAZgps2DB5YSHWRXPwXgKw8xNKTrB8N+carrfP7KexPigBrRrbJNyfDzPBIhaLL2UyxsiTcjNIE7Pv8vl47i7082ZUfYtta0OivvsEBtNkJ6AKPjRZJT1ZUM04K/oFYtOJ9DCsgiE+UNU4nQU7AEYkS2iU8ZPodHTQ9JOSuq/tG57ttVMaraNaB1os01tTDSRBFF5HEE6ryyaLOGAOGooh1QIHjYTWMLPCFphgucJiXDhtgDz9+PVCfv1SkgHkrZWiSKGPXp0HIlN52UYVZAoyo16HI8C9+hCdFx5aXya6AQCtI0Kz1wyVw== 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=PdAMI7+nByQeoBJCM17ch2PslYcJNcq7DTH8sGGuDEQ=; b=njZ3QVbsnzXCBnrmXuOhXPWBax6AchFluBpH2LMluyPMXiu4ulAjg7JHMc9xmW1WA6FWIqhCocsnzKQ1nnQbwgn3E6EfY2gw7/b9jyf2hSJFcTUYYXqdiXrCXb69sZco9A36Uhv7Q6YYof90iAlP0x4euhv4uuRABd4Lhsj8xUdzZjA9yhOMIm0exLcaRYiD7x/MT+sF0mP0vM23an6+fD8saRer1k0Do+MDozhZDw8IDQOIWaJeMce4V4Q7V+LjIdHn7wtbHx7hjzgc0LS8yW1DlD+NeQEJ9+DMfYNrjltOUL/tLoj2PSl8m7kthxvXWsvirQeK1BEEFfasjhT9YQ== 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=PdAMI7+nByQeoBJCM17ch2PslYcJNcq7DTH8sGGuDEQ=; b=KbKIk2BjL74Tw4qBWMJGzXfypUh1OHHDdIZNJsZsVhKG4BFxETMH99fjp/9q+Bx/tk4cBk49FZFjBFnn81/e+QUetwa8ewQrkgWWYfHE7tz7MLOv7RIg6Qk4QoAoqUV5vBinSfkVqirk2xWWwHqrOhK14ybrWCPKYNkWN9MLW+UqgZcL7QMnYJ1/gyVQOI69LagxI2+ffG8dn2VqeKMrf4MIPZDNo5HHp06s3d334yDkNK5tEY+ubQTLCvcG6pmi+LtCu+NLpcytQWoRO4MjwJa7Kgrg3fIINjvL364F/Jqbw6h/NdKJdaXJZCRbAaMQPgkE1lW+A0IEE+5hzCucGg== Received: from CO1NAM11FT021.eop-nam11.prod.protection.outlook.com (2a01:111:e400:3861::50) by CO1NAM11HT203.eop-nam11.prod.protection.outlook.com (2a01:111:e400:3861::312) 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:32:00 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com (2a01:111:e400:3861::49) by CO1NAM11FT021.mail.protection.outlook.com (2a01:111:e400:3861::307) 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:32:00 +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:32:00 +0000 To: Chuck Adams , =?iso-8859-1?Q?Olle_H=E4rstedt?= CC: PHP internals Thread-Topic: [PHP-DEV] Possible RFC: UniqueInterface that throws exception at refcount > 1 Thread-Index: AQHWV4x7jXS7o3BhLEGSRfZHduTrhqkCcEqAgAAASmo= Date: Sat, 11 Jul 2020 14:32: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:1DE78F90B3D6D4585D78A10C3E6600F6FDFFC67312D4C874880729763409490F;UpperCasedChecksum:4C36C249BEEDB7EF78FB1E891CE5A766DA69DA637E49E5D3D0E93624208232EA;SizeAsReceived:7122;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [Qv+7KWBUiviBOQuDNreuFU2sCRmHX0vT] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 311a9255-88ed-457a-067a-08d825a72c1c x-ms-traffictypediagnostic: CO1NAM11HT203: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8LZvSdSg85LhgPGlmkJEVw4BDKj+ky4TJt8cZGVz73tlkJpp6edDjVrFlFTtepRENkaZsvyPJONcVvuAYQdkmtVf6ObA9woWNczoB012JQtbW/9Eta62zQZ4wH7/4zu/cgbojh1ZFkc7xvFdUYLRcaEpFNM1MtF1hZv9jI69DvA8f0f34t1c05gVnU4PgtxlnO9LAm/9Bg4OlCzaiN+rqg== 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: e1xIqONsGJut7xiApsmHA7PfVFSZ7ts6+hLQMO9DkFiPYyvC3pH0Db4Q3DwZKvoVfYe5jBBOTx28C08Vr2OZup0teocMDWoigbjMRTEr1XrG+EBCttA/eJbiUkIZkujHhtgvSAXXfMFk0lNR5coAbw== 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: CO1NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 311a9255-88ed-457a-067a-08d825a72c1c X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jul 2020 14:32:00.2005 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1NAM11HT203 Subject: Re: [PHP-DEV] Possible RFC: UniqueInterface that throws exception at refcount > 1 From: tysonandre775@hotmail.com (tyson andre) Hi Olle=A0H=E4rstedt,=0A= =0A= > I'd like to discuss the concept of ownership in PHP, from the point of=0A= > view of a new interface UniqueInterface (or SplUniqueInterface or=0A= > something), which will throw a UniqueException if refcount > 1.=0A= =0A= It'd seem like it would cause a lot of places where UniqueException could b= e thrown unexpectedly.=0A= Additionally, inspecting the stack trace of an exception would also increme= nt the refcount,=0A= causing yet another exception.=0A= =0A= ```=0A= getTrace()=0A= =A0 =A0 $trace =3D debug_backtrace();=0A= =A0 =A0 var_dump($trace);=0A= }=0A= test(new UniqueObject());=0A= ```=0A= =0A= > Implementation should be straight-forward, assuming refcount is manipulat= ed at a=0A= > single place in the source.=0A= =0A= This would also introduce some performance overhead if every function that = incremented the reference count of a value=0A= now had to check if objects implemented that interface. I'd assume it would= be significant.=0A= =0A= This is something that makes more sense in compiled languages like rust tha= t can enforce uniqueness at compile time,=0A= and the dynamic nature of php makes that less practical.=0A= =0A= - Tyson=0A=