Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79269 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23526 invoked from network); 28 Nov 2014 11:32:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Nov 2014 11:32:01 -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 209.85.212.173 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.173 mail-wi0-f173.google.com Received: from [209.85.212.173] ([209.85.212.173:52783] helo=mail-wi0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/A9-59154-03D58745 for ; Fri, 28 Nov 2014 06:32:00 -0500 Received: by mail-wi0-f173.google.com with SMTP id r20so18266435wiv.6 for ; Fri, 28 Nov 2014 03:31:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=OnicfKw3JlvwqE4TGwRTXwhtLmY3gcACw3b6gcFLqAo=; b=eX10LjhBON/5mBIkyBv09Dr+Z51OPs7DpxdOvCwVRTxI7q2ojlG8mnc4tcgNng6JaM WX2AFZk4ADlQ8575e9kG4LRHaxygJx8Q6b/AD4jJOzBZ3+N0k9y5TdtQmOasKsQwTloT ILfu/uncd7V76osGXRqJKXtzaMZUwnDLVu9Nh6OUeIpdBuvK4mbUE8dmYif5PAWzGboH k5Mle2Mr9nmVwoggsiV6k+0gP2lLkt92X3zTuoPs4wmaWK2UwB3fS4zYGkZKgdKB5pni AMKKDIhYnClJMoeDvo0uv2wqumh4Fl4sAMAnqFo8s/7b9iA28DwPAgA15rSalExS0Y1a HVnA== X-Received: by 10.180.99.1 with SMTP id em1mr60563577wib.29.1417174317093; Fri, 28 Nov 2014 03:31:57 -0800 (PST) Received: from [192.168.0.148] ([62.189.198.114]) by mx.google.com with ESMTPSA id td9sm15534927wic.15.2014.11.28.03.31.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Nov 2014 03:31:56 -0800 (PST) Message-ID: <54785CF3.3080306@gmail.com> Date: Fri, 28 Nov 2014 11:30:59 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Andrea Faulds , Dmitry Stogov CC: Levi Morrison , PHP Internals References: <5477010E.4000000@gmail.com> <493B6453-6597-41CC-9409-52F999E19A32@ajf.me> In-Reply-To: <493B6453-6597-41CC-9409-52F999E19A32@ajf.me> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC][Discussion] Return Type Variance Checking From: rowan.collins@gmail.com (Rowan Collins) Andrea Faulds wrote on 28/11/2014 10:57: >> On 28 Nov 2014, at 09:31, Dmitry Stogov wrote: >> >> I prefer option (3) - invariant return types. >> Actually, return type compatibility check should follow all the rules for >> parameter type compatibility check (may be even reuse or share the code). > No, it shouldn't match parameters, that'd break type safety. What's safe for parameters is the opposite of what's safe for return types. The exception is invariance, which is safe for both. I think you're both saying the same thing: current implementation of parameter checking is invariant, proposal is to make return type checking invariant. Thus, for now, it can share the implementation. Later, covariant returns and/or contravariant parameters could be added, at which point the checks would need to be split apart again.