Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71173 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96419 invoked from network); 16 Jan 2014 10:04:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jan 2014 10:04:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.176 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.216.176 mail-qc0-f176.google.com Received: from [209.85.216.176] ([209.85.216.176:36773] helo=mail-qc0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3D/F0-24763-DBEA7D25 for ; Thu, 16 Jan 2014 05:04:45 -0500 Received: by mail-qc0-f176.google.com with SMTP id e16so2109814qcx.35 for ; Thu, 16 Jan 2014 02:04:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=sqcVXzJBLE3a1u86z0B68nMqwTWolGNB9k0GpRMBjfo=; b=B1q2C+JkLnrkS0m2XlCkbok8nqOyT8WIDQs/48LLTguoOFuXhIV8zpkvoUK7cH249l jvRb/6Nkubt6EOh1xH27ks2+TZq26s7/+un4iiHKxxS0j2+zGltvLMoea89GxtVu3C6v 7KEP8tjB/8uXom9rdC9awTNdXtXUzVlI+feGw4pPoCgp4hdM4W1joV9U7Q4YWIx8cQIx QY0gjbmverG7j4mRePJjwk7fzoDBBc6gwQMrTXSDJipMwZZDEN4sutY60bb/HiS9rVqk DY2iQ1/zxoAvC5UZSXWXrVpRa+JDwAyn7kIwRnH/CBPXr2L0kquyQ22h2r3Mrcp6KgJf rrfA== MIME-Version: 1.0 X-Received: by 10.224.97.7 with SMTP id j7mr13838671qan.81.1389866682142; Thu, 16 Jan 2014 02:04:42 -0800 (PST) Sender: are.you.winning@gmail.com Received: by 10.229.240.193 with HTTP; Thu, 16 Jan 2014 02:04:42 -0800 (PST) In-Reply-To: <93EFD00C-017E-4DBE-A9A4-AEA40109D354@strojny.net> References: <93EFD00C-017E-4DBE-A9A4-AEA40109D354@strojny.net> Date: Thu, 16 Jan 2014 10:04:42 +0000 X-Google-Sender-Auth: oTWcGuWALR2k8vkPWAjarKmPwcQ Message-ID: To: Lars Strojny Cc: Philip Sturgeon , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Introducing "Array Of" RFC From: daverandom@php.net (Chris Wright) On 15 January 2014 21:24, Lars Strojny wrote: > Given I hint for Foo[], and pass [new Foo(), new Bar(), new Baz()] it will > only inform me about Bar violating Foo. I would like to have a more descriptive > error message that contains both Bar and Baz. While I see where you're coming from with this, it's non-trial to implement this in a sane way, both in code and to handle every possible scenario in a logical way. Suppose I pass an array or 10000 objects which instances of 10000 different classes which do not satisfy the type hint? I guess you'd want to do something like <= 3 offenders - give their class names and indices > 3 offenders - give an error along the lines "passed array elements are completely wrong" (or maybe report first three and append a "and other errors") ...but IMO the complexity this would add is not worth the effort. From a consistency point of view it should just use the same error logic as the shiny new variadics feature - which also bails out at the first offender. Thanks, Chris