Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99211 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25519 invoked from network); 28 May 2017 10:30:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 May 2017 10:30:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.192.170 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.192.170 mail-pf0-f170.google.com Received: from [209.85.192.170] ([209.85.192.170:36858] helo=mail-pf0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7E/D0-06590-DC6AA295 for ; Sun, 28 May 2017 06:30:38 -0400 Received: by mail-pf0-f170.google.com with SMTP id m17so35622337pfg.3 for ; Sun, 28 May 2017 03:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=P2k+Hf5eVJ4lxfDQcTfmD33nPYvJbrxIH8EUy2MIHeQ=; b=DwWVdzXuWIFqE3VGUrGjTHfID8Mp0SXvsLTYwWD/euAzMsGeUjudFZZOJ5gOeYZbTb eeYstdQHXEXJ1HNlBpxKVRvEE2EPCH98KwQjStmV48CpBIKIox8o3oGXx0bVLZqkwxjH MkliN8+HqdYVCNuXnGbIatUo0FpBgJlic/yxt31S697Gk9r3+fITE/R1MCiRfuSd9XlD kK1/5WTLJZ7yVAQxMEIhEQ4ArW6y8MF23GdMKrYtoGz47CQzHXa0z3t2SJB1aO/wBkYu 682pRfkv6x0bsYcz1UYhiEJr0DCvcbbxO171ozSslklCF07i3vw7q8Zu2QjYn6Y0cWvu ELxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=P2k+Hf5eVJ4lxfDQcTfmD33nPYvJbrxIH8EUy2MIHeQ=; b=grfhjEAddgKuwka/XLdBtyZDCsW1cFhwCB/Sma7F0sIXqlRZIkrDyknu6GvTx6ADgT cNiJ3WEW24E5p1Wh4pguJtBQdCYKh60fJf+nZWhytMBfkerxiVeVzuWU4Ht+Q+lk1PhO bfT1oFIoLH1nsArHO27/8tShhvGdLZgwNiDESNPqYWdbU9yoY9vqb/+korjA7nYgI/RC lKv64QQZqDCSmlrmmjG4bE46p6UBwMVk5gKLDdJ59k4sX0+2K/a36+6RtrKsVbUmijyS XRYly15CQq9obtU7BfAqIVCfhOqoZ0+kOBvGwwS6hPcDiQq1epASWs5QjIlC5m5P2emP jbHg== X-Gm-Message-State: AODbwcDSZFb2lOwTsE1h76wB+dgo+VcxzfGd8CcoN5jijH1icYw4nrDo Vf4wP30QEjgchDIA6B/txksfj9Le/YTbiWPW7A== X-Received: by 10.99.127.26 with SMTP id a26mr12560254pgd.75.1495967434597; Sun, 28 May 2017 03:30:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.131.23 with HTTP; Sun, 28 May 2017 03:30:34 -0700 (PDT) In-Reply-To: References: Date: Sun, 28 May 2017 12:30:34 +0200 Message-ID: To: Dan Ackroyd Cc: Niklas Keller , PHP internals Content-Type: multipart/alternative; boundary="94eb2c1b4c34890fa10550930f0c" Subject: Re: [PHP-DEV] Parameter type widening RFC From: rasmus@mindplay.dk (Rasmus Schultz) --94eb2c1b4c34890fa10550930f0c Content-Type: text/plain; charset="UTF-8" > > So this breaks the expected behavior of interfaces. > > No it doesn't. It allows interfaces to use contravariance within PHP's > type system, which is different from before, but it doesn't break > anything. The RFC explicitly states that this is *not* contravariance. And if it's not clear, what I mean by "breaks the expected behavior", is, as far as I understand, what this RFC actually does is it *removes* expected behavior. Correct me if I'm wrong, but really all this RFC does, is remove the requirement that and implementation of an interface be type-hinted? To me, that's "broken". You're favorizing a very, very small number of isolated, valid use-cases - by removing the normal, natural, expected constraint that an implementation be type-hinted as specified by the interface. It's part of the reason interfaces even exist - and this simply ignores that and removes these checks. In my opinion, this will very likely lead to a large number of accidental type-hint omissions - and a very, very small number of actually useful solutions to real problems. In my opinion, we can do much better than that, by adding a mixed type-hint, which will ensure people aren't just accidentally omitting type-hints and instead explicitly opting out of it to achieve parameter widening. Solving this from the start also ensures we can have a clean implementation of real contravariance in the future, without that being a break change. > Rasmus, not answering people's questions and instead saying emotional > stuff suggesting other people have made historically bad decisions > isn't a productive way to conduct a conversation. Okay, I'm emotional, sorry about that. But I think I'm pointing out a real problem and a real possible solution that doesn't make the trade-offs of the current solution. That is, I'm fine with introducing this simplified type of contravariance, but I think it needs to be made explicit - simply omitting a type-hint does not indicate the desired behavior; it doesn't indicate anything, and thereby creates a new problem case of accidental type-hint omission. Is there a very good reason we shouldn't address that, if it's at all possible? On Thu, May 25, 2017 at 12:32 PM, Dan Ackroyd wrote: > On 25 May 2017 at 10:21, Rasmus Schultz wrote: > > > So this breaks the expected behavior of interfaces. > > No it doesn't. It allows interfaces to use contravariance within PHP's > type system, which is different from before, but it doesn't break > anything. > > Niklas Keller wrote: > > The interface will just work correctly, what's the actual problem you're > seeing? > > Rasmus, not answering people's questions and instead saying emotional > stuff suggesting other people have made historically bad decisions > isn't a productive way to conduct a conversation. > > cheers > Dan > --94eb2c1b4c34890fa10550930f0c--