Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110138 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 71461 invoked from network); 12 May 2020 14:32:07 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 May 2020 14:32:07 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 11A661804CE for ; Tue, 12 May 2020 06:08: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-ASN: AS8075 40.64.0.0/10 X-Spam-Virus: No X-Envelope-From: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074086.outbound.protection.outlook.com [40.92.74.86]) (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, 12 May 2020 06:08:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qj+kWt6PDMcTWww5YSNl2FJ6FuGODtBltorYXskSjQX92HpHR1YfmkWkdwO/FGF+kmVpN8ynNgc8o1PnQfN5kxgLoQpd+Br1ONnsG/KcAbXvBOkoNRzjSMGLXT6QzVXGIvVs9PF9/iUrCOuAZAFqBEj0KQTCwmKoF4x0WmRGhvZ1B9mjW5T5FzR/aER0srY82dhlLqpC/9pOUehzEQhgvXGIYY+j4KunfBWcgQgoxDjkWY5zD/MJrO1lY/zCPfGMfX3bcPTqQxrHE3B5qeCebaD8ROlLdyueOIYhOwqxnkl91Apzys/pSYNEcu/NimSOP5ve1cbFJla2lRi34f6Qqw== 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=YlJSVQiPQDM3vVPrZJY9+zj1YR+YM1rriPkwR+B9OxI=; b=hz4H+wCRxRlEbAZO9ChJucVKAmaO1AIg+Lo8IzTW+jJOFp5xhDW0ylxblG/mYk4QHNlc7/8IdAJ7xSLy0XjXMFHhwOqmIEYrGbpHLU/IabWzL3FCg6alDxsfX/aOgHygNHsOFchjFY3yTYO8Sr1F+HOOOw61cT6vqpK3xdopJKX9Sarji/LCchOpFMA9AgQoEilraHXn7YlV/Qcut6aW34uUBsGxtT68iaHmVU4fYGuMgFvHcmbGE5+l8+a0mmLoJ1IffqjKZBpaF16kLtTyabpu0evMeCmSh2uDsBMQJKJhZGosmrILIutoLBen/F0+BFRPWRE2w+U0ipjLKUmV/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hotmail.com; dmarc=pass action=none header.from=hotmail.com; dkim=pass header.d=hotmail.com; 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=YlJSVQiPQDM3vVPrZJY9+zj1YR+YM1rriPkwR+B9OxI=; b=Rv9sQohlb07Kf9KTbXeGTzHYF19k7x58IZg4twGgDklRE85Y+XHdir8BCI3QltizHMD0+TMsrEfEn1UUQ9YWCyAq6q2VSjSA6fe7EjTA7WbuTW3j6TaDQfYn2a6VB+LUQE2dmU1FlPbnUiNkFxKC26wVyjO2+DPJXGYYhYn39ryVmvc0tLqlkF9b6Fg+R18ZvQzmBr4Eo77BHwzQv456ip2WEWZoHHSh0cGIXHPipbMyG4xM1tljobcwqpaHU9jnGIavYNYVq5gKLqEHlrAVFrRGRS1UNRIbJLHEGI3yTvvJeAWsdu/GwjiFAXU5UCtfBmjVYe31Q2GAr3i05DsMWg== Received: from DB3EUR04FT056.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0c::48) by DB3EUR04HT129.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0c::353) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.27; Tue, 12 May 2020 13:08:45 +0000 Received: from VI1PR02MB4703.eurprd02.prod.outlook.com (2a01:111:e400:7e0c::48) by DB3EUR04FT056.mail.protection.outlook.com (2a01:111:e400:7e0c::69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.27 via Frontend Transport; Tue, 12 May 2020 13:08:45 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:689B73D3F98A5D41348E3A3A3491294287488E08B2383599BA605B5E66EB0B43;UpperCasedChecksum:7EB0C454EFC4AC0E5122D6206AE5B104285FFCDF5B1D227506294BE806D04E69;SizeAsReceived:7996;Count:50 Received: from VI1PR02MB4703.eurprd02.prod.outlook.com ([fe80::61d8:9f5e:4baf:492d]) by VI1PR02MB4703.eurprd02.prod.outlook.com ([fe80::61d8:9f5e:4baf:492d%7]) with mapi id 15.20.2979.033; Tue, 12 May 2020 13:08:45 +0000 Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Tue, 12 May 2020 15:08:43 +0200 Cc: Nikita Popov , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Sara Golemon X-Mailer: Apple Mail (2.3445.104.11) X-ClientProxiedBy: PR0P264CA0176.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1c::20) To VI1PR02MB4703.eurprd02.prod.outlook.com (2603:10a6:803:8f::13) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2001:7e8:cb47:6400:b8a8:c0af:c0:e8b7] (2001:7e8:cb47:6400:b8a8:c0af:c0:e8b7) by PR0P264CA0176.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.28 via Frontend Transport; Tue, 12 May 2020 13:08:44 +0000 X-Mailer: Apple Mail (2.3445.104.11) X-Microsoft-Original-Message-ID: X-TMN: [2D56e1Wjp7n9cAaBnkZegqALCdjMM4iF+6se9Wc3dKQDuXCMRaTxcV2TNp4aPrCb] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 1ad7e178-bd12-4cde-6454-08d7f67599f9 X-MS-TrafficTypeDiagnostic: DB3EUR04HT129: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SRCLESSEdOKhHg9VRr3aDdd/Ongg0U4NBoLp7saIibd3GR06b6PE2r94S7/IRmcREIgJUXBllzw00SKOLdQlpEt4yOKRY1g9F07ZbJTM8wFkxnkQdA3TpnFEFTJawdb00PaoBKVaqrxJWdeZpSCCY9jYAZXrG+tR2QlKre/HQXRcqnO3eXpbw959EoyvdrRsTNZ3mlKkoYRjbywkol+2eA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR02MB4703.eurprd02.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: Fjp14gYH0nleQeKZvmXLC/D1LWHXGYujQ9Bjlp1N4FseeVvTx3QElpUkwejcVBtOY1eFV4ppfrn75OlQIDqHKWc6dEZk+1zSmhbHPP/oH8c1WHWbKPbAurDe9RrN4uDc1uoNZozBJEkG63pV+Rgby7L82GIdvDecP1q0ygMIxX1293bhrlymfe2vUl27WffuzMs6i3ygTaclZlYdHjgfSg== X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ad7e178-bd12-4cde-6454-08d7f67599f9 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2020 13:08:45.7385 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3EUR04HT129 Subject: Re: [PHP-DEV] Re: Making all Traversables an Iterator or IteratorAggregate From: bobwei9@hotmail.com (Bob Weinand) Hey Sara, > Am 12.05.2020 um 14:49 schrieb Sara Golemon : >=20 > On Tue, May 12, 2020 at 3:26 AM Nikita Popov wrote= : >> // WeakMap::getIterator(): Iterator >> ZEND_METHOD(WeakMap, getIterator) >> { >> if (zend_parse_parameters_none() =3D=3D FAILURE) { >> return; >> } >> zend_create_internal_iterator_zval(return_value, ZEND_THIS); >> } >>=20 > Given that the body of this method seems to usually (always?) be the same= , > why not define it in InternalIterator and allow it to be inherited? Good idea. >> There's some bikeshed potential here regarding the class name. >>=20 > Not personally over-picky, but I do agree that "Internal*" is a bit > awkward. Unfortunately there's not much that's better and appropriate fo= r > exposing to scripts. This might be one of those rare occasions where > exposing "Zend" into userspace makes sense. "PHP" is overloaded into > several meanings that are significant for userspace developers, but > something like "ZendIterator" might convey the right level of "This has t= o > do with the engine, please move along". Or maybe go verbose: > 'IteratorForExtensionClassImplementations'. :p We call the engine Zend, but eih, that's a rather internal detail we mostly= don't leak into userland, and I wouldn't do it here either. InternalIterator is the better choice I think. >> ZEND_ASSERT(scope->get_iterator !=3D zend_user_it_get_new_iterator); > > Does this mean that if I do `class Foo implements InternalIterator {}` in= a > script, I can assert (crash) PHP? I don't see anything obvious (at a > glance) preventing me from inheriting from InternalIterator. The class is marked final, so userland won't be able to directly extend it.= (zend_ce_internal_iterator->ce_flags |=3D ZEND_ACC_FINAL;) Bob=