Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104195 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 4452 invoked from network); 5 Feb 2019 19:58:28 -0000 Received: from unknown (HELO mail-lf1-f47.google.com) (209.85.167.47) by pb1.pair.com with SMTP; 5 Feb 2019 19:58:28 -0000 Received: by mail-lf1-f47.google.com with SMTP id f5so3099853lfc.13 for ; Tue, 05 Feb 2019 08:39:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JZ/NDOar1aj/wJL354SGSXUlDL4sCoRBYCARMhdem1U=; b=RTBirPwRCgiLL1J52yURH4NMuVNAgqQYBZRCcpZKOH0mQl9JzYuu4gn0U4s0JnkWzK AdMPT2p3vCkS8A8jfMz0tNtTbHuB972eJE8tiJXwnuy/PGnOChIpO+3HCUXbxaX6puJd oxZkp99rotJMeUok1MAEmSvNC+f5cJPt2c0HGETa8dLRfVmpUGW9TBTJYsH/xvKaLYtr Xxx1JKB5DhUAV0OxiLp3gThSvLKeIDc2amWkvC4WNRbJQwej9apDzjSaa4AVT+USQi1K fsCueXzq2rL6wPeYkgRjMo0Gs5SU/ELx8Q+rRDqSGgJdQWHBgwF4QEBmB7MgNMeFgc9A cQWw== X-Gm-Message-State: AHQUAuYFjQJXzmnx6CfidR5DJ0vcpNLOaVG+F6VvEckdMvB2VeSTmAYy 9s+xB29PaJfZcoMJzqtY1mtGxGdReR2faZcXOO/2mkZu X-Google-Smtp-Source: AHgI3IYVovgOpGSHyyTv2RTbAn0oAQ1sW5kPOhcQXNpLeHhlmB2JJWpP1Lu0rZD6MUPAKvIKuskbFPiwXvy9kJe8quc= X-Received: by 2002:ac2:54b9:: with SMTP id w25mr3647266lfk.15.1549384777477; Tue, 05 Feb 2019 08:39:37 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 5 Feb 2019 09:39:20 -0700 Message-ID: To: Craig Duncan Cc: Internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [VOTE] Making stdClass iterable From: levim@php.net (Levi Morrison) On Mon, Feb 4, 2019 at 11:58 AM Craig Duncan wrote: > > Hi all, > > Following the discussion it's now time to vote on whether we make the > stdClass iterable or not. > https://wiki.php.net/rfc/iterable-stdclass > > Note that while there is an implementation available, the vote is only on > whether stdClass should fulfil the Traversable interface or not. > Nikita had some ideas on a different implementation that I'll revisit if > the vote passes. > > Voting will end in two weeks on 2019-02-18 > > Thanks to everybody that shared their opinion and raised concerns during > the discussion. > > Craig I just wanted to pipe in to suggest an alternative approach to accomplish some of the same goals: an external PropertyIterator. - It could allow us to refine which property visibilities we care to iterate over. For instance, if we are in a protected or private context we may want to still only iterate over public properties. - I think that with typed properties we will see more data-only classes which would benefit from an external PropertyIterator. Of course, that still means `stdClass` isn't automatically `iterable`, but if you want it to be then you can pass in a PropertyIterator instead.