Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100965 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50254 invoked from network); 27 Oct 2017 12:36:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Oct 2017 12:36:04 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.50 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.50 mail-wm0-f50.google.com Received: from [74.125.82.50] ([74.125.82.50:45495] helo=mail-wm0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 74/FD-28573-33823F95 for ; Fri, 27 Oct 2017 08:36:04 -0400 Received: by mail-wm0-f50.google.com with SMTP id 131so3287825wms.0 for ; Fri, 27 Oct 2017 05:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:from:message-id; bh=FK4QXC3GFw/OFIPcCJ8hMev7wOIf1xrx25fxPyYyq2E=; b=PMkKXoBi+DhdGj3To3+1MSmTBg7BdqHxOmRDi4j6ozPkVMElY5S6w2d8r5B4jNKgZX sfa3TgHi8PCUrAZjdiRLkfMeEC7AH8Kufw5Ngx4FIq2dfGN2e5bglxowa9LLtR47HukH nWmxfWfFYYuGOdBFNHxifyeTFKhq4g5DcMkwXEDRKgmE6tUIa/x4ltwT9mIJaB/g6bwk zX9646QktQmf9tCB77MlPah5TaNL+Q75bQJBfj0iHHtLMCG9+P3FbQSeO8JKxbYYpAlu 5vlUgdZDKLaSmBL6kAD0tAa7CimT3Yb28ykxx7BpNmP6LewL3bb0ZaNUB8t2kY9Z2ga+ MOSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:from:message-id; bh=FK4QXC3GFw/OFIPcCJ8hMev7wOIf1xrx25fxPyYyq2E=; b=Thma7she04b8j34S4iT70Ys0fR+nuak3rMpW8TuHEDOWtKHo0WX0h/8mULXF60jmPU VB+tdKf9mKGy69zeohzG505g8y5XeW2lqEn44cbBmK1jJX/3/msZUhwMQ+uInsIbKGYJ iWafVPKrhfSeSO8roYX90w/RfdQz7YViK/bfxY55YJer+4wdbUm1JqMl8i52obJ88yFV sOGujOEKkUdxoqd6dsu9sT7hre1SvxjeUIQANemshawpQPDlgnaTiuTdbS2ekL8XqWC3 FHx39hkmT/jrhWkjgvEJDA7ZNTOjN7wDCQchJgDhPRTxoE0uP848ZvHKUIDiiSf8MfN+ enBA== X-Gm-Message-State: AMCzsaUvILlJUE32yf6YC0nPMhEeelMvFYF8dUTAc+01Rw9duTJcg+1W KqqSz4eddZBHOh6spMgkcXdIxTr4 X-Google-Smtp-Source: ABhQp+Qh8a2cxzCwZZxEthBKhffr/gIdfwJ/pYkltF5mf/oXQpCA3KNEK2ktkH5MRcERfXx2OlVBCg== X-Received: by 10.80.224.205 with SMTP id j13mr440340edl.216.1509107760456; Fri, 27 Oct 2017 05:36:00 -0700 (PDT) Received: from [10.93.168.106] (94.197.121.134.threembb.co.uk. [94.197.121.134]) by smtp.gmail.com with ESMTPSA id e56sm5693660edb.72.2017.10.27.05.35.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Oct 2017 05:35:59 -0700 (PDT) Date: Fri, 27 Oct 2017 13:35:56 +0100 User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: internals@lists.php.net Message-ID: <60A7E2FB-3C1C-4C28-B400-57AB14F54687@gmail.com> Subject: Re: [PHP-DEV] RFC - Array Of for PHP 7 From: rowan.collins@gmail.com (Rowan Collins) On 25 October 2017 22:52:37 BST, Dan Ackroyd wro= te: >Although 'array of' as well as full blown generics are popular ideas, >I'm pretty certain the RFC failed due to the type check on the array >happening every time the 'array of' was passed from one function to >another, which would make it too slow to actually use=2E The fundamental problem with extending PHP's type declarations - either to= more complex types, or to other code elements such as properties - is that= they are currently always checked at run-time, not with a separate static = analyser=2E It's notable that in Go, the runtime type checks are considered= a "development only" option, and strongly discouraged in production code d= ue to performance impact=2E I wrote about this a few months back here: http://rwec=2Eco=2Euk/q/php-typ= e-system One possibility if we do want to keep the current run-time approach is to = cache type information against values (zvals) so subsequent checks become q= uicker=2E The problem is working out exactly what to store and when to inva= lidate it - if you append 42 to an array that passed int[] on the last chec= k, the ideal would be for us to know the type is still valid=2E Regards, --=20 Rowan Collins [IMSoP]