Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110141 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 81284 invoked from network); 12 May 2020 15:21:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 May 2020 15:21:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CB9961804F6 for ; Tue, 12 May 2020 06:57:58 -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.1 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_NEUTRAL autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS30827 82.113.144.0/21 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) by php-smtp4.php.net (Postfix) with ESMTP for ; Tue, 12 May 2020 06:57:58 -0700 (PDT) Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id DEC4110C084; Tue, 12 May 2020 14:57:57 +0100 (BST) Date: Tue, 12 May 2020 14:57:57 +0100 (BST) X-X-Sender: derick@singlemalt.home.derickrethans.nl To: Sara Golemon cc: Nikita Popov , PHP internals In-Reply-To: Message-ID: References: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [PHP-DEV] Re: Making all Traversables an Iterator or IteratorAggregate From: derick@php.net (Derick Rethans) On Tue, 12 May 2020, Sara Golemon wrote: > On Tue, May 12, 2020 at 3:26 AM Nikita Popov wrote: > > // WeakMap::getIterator(): Iterator > > ZEND_METHOD(WeakMap, getIterator) > > { > > if (zend_parse_parameters_none() == FAILURE) { > > return; > > } > > zend_create_internal_iterator_zval(return_value, ZEND_THIS); > > } > > > 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? > > > There's some bikeshed potential here regarding the class name. > > > Not personally over-picky, but I do agree that "Internal*" is a bit > awkward. Unfortunately there's not much that's better and appropriate for > 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 to > do with the engine, please move along". Or maybe go verbose: > 'IteratorForExtensionClassImplementations'. :p I do not believe we should expose the Zend term into userland. Let the bike shedding start: Perhaps just "EngineIterator". cheers, Derick -- PHP 7.4 Release Manager Host of PHP Internals News: https://phpinternals.news Like Xdebug? Consider supporting me: https://xdebug.org/support https://derickrethans.nl | https://xdebug.org | https://dram.io twitter: @derickr and @xdebug