Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79272 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29588 invoked from network); 28 Nov 2014 12:27:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Nov 2014 12:27:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.179 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.179 mail-vc0-f179.google.com Received: from [209.85.220.179] ([209.85.220.179:52483] helo=mail-vc0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A4/BA-59154-C4A68745 for ; Fri, 28 Nov 2014 07:27:56 -0500 Received: by mail-vc0-f179.google.com with SMTP id le20so2961206vcb.10 for ; Fri, 28 Nov 2014 04:27:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=67FzoRTTZxJ8P3hrWwJbewkWigQy6oVO8UeJeJI4bgs=; b=Aweb26LKCNNlgcQAKGI1qxARsxHSGRtynw1IjDqv9c98ivdXO2hyP6GFJ+ZmVYNYyN e55b2CwaeAtHTTeW0tgJC8YvPhYRsfYUhTjF6Xn78qoS0gbHa3yhx20NvZn6nCuv6KIi RB7A6rdoTgwM1ntSt84HB/0VtsWlDfoz4IfeZq9zW1xoXOr0ZnmzjWdyj9zRGXdwJGQL ZiLTVK+RZG1f5PQtxdS5i+QLozzA5T7e9jtZt1UeMgr2ab4ywAtm1+Yhw20mnPFPSYUC 6i1xxZzod/dhoEHxvrkVw6kHuPDSWKqLFBvDSzOPt4a0pPa9mTU2toP+1XtY3U/SVXXR 7fHQ== X-Gm-Message-State: ALoCoQnV4odKOcgGBQVm2uRQKKsWTwNBC7lNP5bllUyj0HhYhm9PDKvaLLbQYxJ7U5RuXDMTpNSn9GTlctj5MqxrXwVmfqRIVC7NfJKK2BplvSZchU3thoyHQMrNL4RdD9aOrq0zky6czYrlJlulxUBoNC8Y/uqRXw== MIME-Version: 1.0 X-Received: by 10.220.143.16 with SMTP id s16mr22372462vcu.53.1417177673275; Fri, 28 Nov 2014 04:27:53 -0800 (PST) Received: by 10.52.176.231 with HTTP; Fri, 28 Nov 2014 04:27:53 -0800 (PST) In-Reply-To: <493B6453-6597-41CC-9409-52F999E19A32@ajf.me> References: <5477010E.4000000@gmail.com> <493B6453-6597-41CC-9409-52F999E19A32@ajf.me> Date: Fri, 28 Nov 2014 16:27:53 +0400 Message-ID: To: Andrea Faulds Cc: Rowan Collins , Levi Morrison , PHP Internals Content-Type: multipart/alternative; boundary=047d7b33db6accb5250508ea63b5 Subject: Re: [PHP-DEV] [RFC][Discussion] Return Type Variance Checking From: dmitry@zend.com (Dmitry Stogov) --047d7b33db6accb5250508ea63b5 Content-Type: text/plain; charset=UTF-8 I didn't get what you mean. parameters are invariant, "invariance, which is safe for both" and " it shouldn't match parameters" are contradictory. Thanks. Dmitry. On Fri, Nov 28, 2014 at 1:57 PM, Andrea Faulds wrote: > > > 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. > > -- > Andrea Faulds > http://ajf.me/ --047d7b33db6accb5250508ea63b5--