Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96952 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48431 invoked from network); 17 Nov 2016 14:06:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2016 14:06:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=joshdifabio@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=joshdifabio@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.182 as permitted sender) X-PHP-List-Original-Sender: joshdifabio@gmail.com X-Host-Fingerprint: 209.85.217.182 mail-ua0-f182.google.com Received: from [209.85.217.182] ([209.85.217.182:34678] helo=mail-ua0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/40-05303-A59BD285 for ; Thu, 17 Nov 2016 09:06:18 -0500 Received: by mail-ua0-f182.google.com with SMTP id 51so143115345uai.1 for ; Thu, 17 Nov 2016 06:06:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RhVkExWWKTiDomNkVbHTs/74GJz76Wm6NoO39a9NlTw=; b=x8NhlrqZcLzNlf/hO30kO8OuWEojPXyh9/G50pQviohQVwfQyFI89SofYezWMHzJAa Vm5jACNmragwQiKJ677CL/cTUV9Nl5Vj1Ut1Vt27t47KYPYCuI8o80YOjpybmISvRDYP atG87mgA13cBgG1M3mQVt2zFvLPhtphsHcPYgUCmJemyQHC6BObJQCGVJ39vEAoVt64b Q5fuUX7jFp29P6lRsrwQY0sl7rxe1FKqsyyjfpLTDm7L7MJXRUM5S1YGNZbDuMGNlqyX XMSu4SIig8VIYpg8V651+bFkefWzt9Rc8Qr2IurJ3NFS/ApYhMZQLoW3m3Fy6/c+nPdE nkNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RhVkExWWKTiDomNkVbHTs/74GJz76Wm6NoO39a9NlTw=; b=lYEUqLfYWuuEOb+1Q2TqRk/khlSoATiFHgLSzG/p3QZZSX/B1UcYVfxaHFsDso1NNW FsX6SFepiI54w1QAtbcTxKLZmmuUtGzdAmxRKh2prrD4rNlLp+AiIlfBkOXBp1qPGXl6 0uMgrnWRu3UlUWQXRdULNmnm9dHlA74eMqDQd1Srg2MAnj1KJ76wrOsm0oQU4Qo6BOUt rwHfmWrHsT4oFYzcBf8om3N0xSN5PltveIx0de+u6TgARx8ARTccOKm5j8a91ieYtJbp q6hquDHaVvsWU+eu+5zSfbuMl7g7HWVsb95mpmLuOxU7uQg9pofPKlcefH7VuPM3EhVy bsbw== X-Gm-Message-State: AKaTC00Y6fGhLR/jnCWj/sCIorlGTjeLT2Jut6UQH43w01tY8P+cE1ydreSPX5YxFjb52d2ss4lYTZNYsw6LPg== X-Received: by 10.159.36.179 with SMTP id 48mr1858648uar.80.1479391575459; Thu, 17 Nov 2016 06:06:15 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 17 Nov 2016 14:06:04 +0000 Message-ID: To: Craig Duncan Cc: Internals Content-Type: multipart/alternative; boundary=001a113d0d0856cd4805417fb155 Subject: Re: [PHP-DEV] Countable Type Hint From: joshdifabio@gmail.com (Josh Di Fabio) --001a113d0d0856cd4805417fb155 Content-Type: text/plain; charset=UTF-8 On Thu, Nov 17, 2016 at 2:01 PM Craig Duncan wrote: > On 17 November 2016 at 13:50, Josh Di Fabio wrote: > > What's the benefit of such an interface? Why not simply ask for `int > $count` in your param list instead? > > > Using the example from my original email, it's a bit awkward to always > have to pass the count of a countable: > handle_records($result, count($result)); > > The number of items in a countable can be established from the countable, > asking for it as a additional parameter doesn't make much sense to me > > Apologies, I thought you were simply proposing the following: interface Countable { function count(): int; } But you're actually proposing the following as well? interface Arraylike extends Iterator, Countable { } I can see the use of an interface which combines Iterator and Countable, but not Countable on its own. --001a113d0d0856cd4805417fb155--