Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96946 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34771 invoked from network); 17 Nov 2016 11:49:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2016 11:49:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.193 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.213.193 mail-yb0-f193.google.com Received: from [209.85.213.193] ([209.85.213.193:34284] helo=mail-yb0-f193.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/ED-05303-3399D285 for ; Thu, 17 Nov 2016 06:49:09 -0500 Received: by mail-yb0-f193.google.com with SMTP id h184so5808109ybb.1 for ; Thu, 17 Nov 2016 03:49:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ghsV1UxMDF4xvS11/gOAdMuDPBcPgckTlyNDgv/IVTY=; b=ZYSWUKblGtUsgH+UTbUKpCrtPAZ0fsbEjrHNFhkA3IAVqEQGhkH6IQb5XWZpkEUwAu nD1PmkdT8OvbhLeQXzFKk5MkpAKpUi7MX8JSwBKkoXxxC7rci/O2I0o06cbV1yk1NggS +WemJ38COjjNFZyN7GqDM+LZLImqUx8zZVOnPBw5uElWzJPXIb5VYJwlAkdlvBq/YY0v pEA52VmzqQeU9jVRKqgt+6wbNk74XtMOnKUXAVYzSc8K6urcnwfsUJAPNi1BtAYnPVgi 3SpymNS7e4ryXmYdL8DfI6JM58TI8rh8qB3hPZqNT1QV5yjAVjEyCrvgtj0yuApyAUZj k9UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ghsV1UxMDF4xvS11/gOAdMuDPBcPgckTlyNDgv/IVTY=; b=lIYJ5N7xrvGejhJNdwQ1Mf+wq+PGCDkC4C3vbMyzWbHKJnEX3twVehmCoqbe7P0f57 tBCCP0GawmcfbUuL4kVyM8714gLdb3bVyW3ydaQAMAs8t0n+divPgouoezcfJWQdzJ0J 65j5Y0qTLtFIrbKY8gBDwt8Q3VkcI01sOycBPe8hzqVr+GTd6N2KEJEhHnKJrNkopGgh jzYr3FmmAB8kxIaYeWcthqFC6it+pmW7tP+afq7tJ/NZNAX+5q5c/CWsFwj6pbNfJqc1 shIFmIek3hfIKZ9uhPZ5RdnIGqfjiJ3vec0NNIKONsQqBGjGhPYEizb+I0zjFakpIFtt kRIA== X-Gm-Message-State: ABUngvfoZvVsUXAkT21BlIvgomuA8nEH+3NbBOVBc97UKUdFNWZ7Ua9LBE+eyVO36oBPaqv+lQ5sbbHXoXmu1g== X-Received: by 10.129.78.207 with SMTP id c198mr2250385ywb.295.1479383344691; Thu, 17 Nov 2016 03:49:04 -0800 (PST) MIME-Version: 1.0 Received: by 10.83.67.21 with HTTP; Thu, 17 Nov 2016 03:49:04 -0800 (PST) In-Reply-To: References: <2b46dcb5-03e2-59dd-b04f-d1877fd603bc@gmx.de> <9c4e33c3-cd8c-dc29-89d2-c91abfb702e0@gmx.de> Date: Thu, 17 Nov 2016 12:49:04 +0100 Message-ID: To: Joe Watkins Cc: "Christoph M. Becker" , Craig Duncan , Niklas Keller , Internals Content-Type: multipart/alternative; boundary=001a114dcd70bf414d05417dc608 Subject: Re: [PHP-DEV] How to detect classes with a count_elements handler in userland? From: nikita.ppv@gmail.com (Nikita Popov) --001a114dcd70bf414d05417dc608 Content-Type: text/plain; charset=UTF-8 On Thu, Nov 17, 2016 at 8:30 AM, Joe Watkins wrote: > Morning, > > Just to chime in ... can you split the PR into the RFC, and the new thing > please. > > Just another question on how we could make objects that have > count_elements (which is in object handlers) implement an interface on the > class entry (which is detached from handlers) ? > > I'm sure it's doable, but it doesn't look very straight forward, some kind > of hacking in instanceof maybe ... not sure ... > I don't think this needs any magic. We simply implement the interface by convention. Just like you are supposed to implement Traversable if you're implementing get_iterator. Similarly you should implement Countable if you're using count_elements. Nikita --001a114dcd70bf414d05417dc608--