Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96957 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57592 invoked from network); 17 Nov 2016 15:25:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2016 15:25:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.214.45 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.214.45 mail-it0-f45.google.com Received: from [209.85.214.45] ([209.85.214.45:35000] helo=mail-it0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D0/F1-05303-5EBCD285 for ; Thu, 17 Nov 2016 10:25:26 -0500 Received: by mail-it0-f45.google.com with SMTP id c20so283454535itb.0 for ; Thu, 17 Nov 2016 07:25:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pthreads-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0wliFSr7TXVh4cqtwkUHae6eNWAp5rSylJdPrDXfzVE=; b=sgE1mAsWSH0d74+znsF6VwFifNLfchftdfMliMM4TNmPrp/qT2MnL03SqxjbZtqlof xVpKx3Jnlc2qKjkgE+X9MzzEyhc81pdUSJActMukfVt4wWZYkIkZkfqAjMjuBgnWY4uX Uvz9Clgn983RKOq9FPpbnyN5MwfLZyEBDmrzYjewVHYpsgpJHv21JEe8KPguk8k6xp4u gqE4t+FTGeZUx/L8i/gUnAVfk6yFkAyAOZxe6zak+XukCKuJZCYdij5cB4NPMGIAb+fU 4E+SVDXviGS7TkUanouef02j62l6924s6pXgNkRoJL5eWk78P6eDCtifQzmtLEC/E1Gq IHAA== 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=0wliFSr7TXVh4cqtwkUHae6eNWAp5rSylJdPrDXfzVE=; b=OCyh9nUyiDIIV5kzReq5KoICaX4TufD5p1cqGQwZcZ+7PXFIRdfq2OTy8HIIchNLMH +eAmaZdcECRscU8q12/nUP4ZvTc1rxCohmcW+wzpBbSbOb58eL9SKlQ3mKVrZqi5D5AJ vdI/2YfIDd57UyXddxa2Q5dgDDKYI1y2BeW+UGtlxbGtY7WRhcSS+CMY5ump33hfh1c2 DMzdNG+vE3R5DJnEN/pD1yQn4BaV8x5LGoAiPDhzalphwDKofij8KjMCDDv9dUSeiUjt K6kqyrHtwGsVuJwWdJoxfL2iPITSUI98uh8AJneOXwVa0xlLqeEXKZOd5TVTJI1qKwjE V8/w== X-Gm-Message-State: AKaTC03CPoxiXFyfHv3z/apWlHcvakd6xAectGzUgV/jONTSz9xRJRqP/izocwgxu4mEaplOsJGjFnbgZJ2JRA== X-Received: by 10.107.168.223 with SMTP id e92mr3333660ioj.40.1479396322568; Thu, 17 Nov 2016 07:25:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.79.102.3 with HTTP; Thu, 17 Nov 2016 07:25:22 -0800 (PST) X-Originating-IP: [109.157.245.230] In-Reply-To: References: <2b46dcb5-03e2-59dd-b04f-d1877fd603bc@gmx.de> <9c4e33c3-cd8c-dc29-89d2-c91abfb702e0@gmx.de> Date: Thu, 17 Nov 2016 15:25:22 +0000 Message-ID: To: Nikita Popov Cc: "Christoph M. Becker" , Craig Duncan , Niklas Keller , Internals Content-Type: multipart/alternative; boundary=001a114275bc4a063d054180cc36 Subject: Re: [PHP-DEV] How to detect classes with a count_elements handler in userland? From: pthreads@pthreads.org (Joe Watkins) --001a114275bc4a063d054180cc36 Content-Type: text/plain; charset=UTF-8 Afternoon, A change in convention makes sense, and sounds much nicer than hacking anything to make it work. I do prefer this approach to yet-another-function. Is changing convention all we would do though, or would we raise a warning when handler is present and interface is not ? Cheers Joe On Thu, Nov 17, 2016 at 11:49 AM, Nikita Popov wrote: > 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 > --001a114275bc4a063d054180cc36--