Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87201 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28382 invoked from network); 16 Jul 2015 15:42:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2015 15:42:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.170 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.170 mail-wi0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:34438] helo=mail-wi0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/11-16799-5F0D7A55 for ; Thu, 16 Jul 2015 11:42:45 -0400 Received: by wibud3 with SMTP id ud3so18683058wib.1 for ; Thu, 16 Jul 2015 08:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:references:from:to:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=O8V/iLmD7fVcdGslbAQpvF1nsObiDVkxN/S/qH4TlYI=; b=vZbNCAtCjVMEo9DEzWXEMvY8P/mAxoHf1todSc5u52OPs0L8njRuL9+u3UKhHSTVCI ypa844QuQPVkc/KPCes8G9ZlkLOFrdLJU6WsQujDMTSgsFV+xV+I6RarNLUih1tW2S0q UR1sSHZImEni3VICYtPQ4PGowVbbF4mSq8w8Etd0bju7xSbj6KV7l1H8hQlafoYU4SJW pl1+JvIJGttng9cb7rqX1rFxygYCaQwfMQgEJz5YOF5tvYnnZm/u/dD8uAtUEe9xgH1K IPPqglIYh/2pL9NDf1ZpPtnd+F45nMJSMrONqahq0scMVKSDvNE4RPUeXMXPNteDfYUt 3GaA== X-Received: by 10.194.187.170 with SMTP id ft10mr19816840wjc.26.1437061362391; Thu, 16 Jul 2015 08:42:42 -0700 (PDT) Received: from [192.168.0.136] ([62.189.198.114]) by smtp.googlemail.com with ESMTPSA id be9sm13704880wjb.26.2015.07.16.08.42.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 08:42:41 -0700 (PDT) References: <1436967838.8300.16.camel@kuechenschabe> <47DA8928-322C-4869-809F-BABDCA20FFB5@gmail.com> <55A778C7.1040100@gmail.com> <55A789B5.60906@php.net> To: PHP Internals Message-ID: <55A7D0DC.8090804@gmail.com> Date: Thu, 16 Jul 2015 16:42:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Consolidation of Traversable and array operations From: rowan.collins@gmail.com (Rowan Collins) Levi Morrison wrote on 16/07/2015 16:23: > People have talked about creating types like so: > > type Iterable = array | Traversable; > > which could then be used as normal: > > function foo(Iterable $f); I kind of like this idea. > Why special case a pseudo-type if we can have a generic > way of making them in user-land? Well, for the same reason as large amounts of the core library exist (and PHP's is small compared to some): standardisation and ease of use. I think "array | Traversable" is a common enough use-case that it deserves a built-in name, even if a userland naming system is available. Regards, -- Rowan Collins [IMSoP]