Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99212 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41720 invoked from network); 28 May 2017 12:27:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 May 2017 12:27:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.218 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.218 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.218] ([81.169.146.218:24978] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2D/A3-06590-042CA295 for ; Sun, 28 May 2017 08:27:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1495974461; l=7276; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=aJo1L9PdRqqmBbCGYhmryHyl4Kx7hEyUn8EWbR5Zb+o=; b=EO/kGSITOUtfhMB+YBfxP4eutARhZ776U2k0QHN+Xyn8Gts9XXVGAGemKZFxHhkwlk /dUtaEjyy09R5buSFv4OqLRF4JQOKezCXOJC+CdbxtIuCjF/9/LrM40x7+GhXHR5CGcy oizyvBQl7zeDcX+XdC/JRuf4/8ohwbcO5l2Fc= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoNHBqX73Q== X-RZG-CLASS-ID: mo00 Received: by mail-oi0-f43.google.com with SMTP id w10so54759870oif.0 for ; Sun, 28 May 2017 05:27:41 -0700 (PDT) X-Gm-Message-State: AODbwcCFiL14VT+FKsLKfEMksXaLiE07w9C5f5ROvh0wAiubPXV01Lpy cTp0TUtj6YFRgOWkyLoFf7ab9Kjncw== X-Received: by 10.202.62.70 with SMTP id l67mr5062785oia.46.1495974460547; Sun, 28 May 2017 05:27:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.176.133 with HTTP; Sun, 28 May 2017 05:27:39 -0700 (PDT) In-Reply-To: References: Date: Sun, 28 May 2017 14:27:39 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Rasmus Schultz Cc: Dan Ackroyd , PHP internals Content-Type: multipart/alternative; boundary="001a113ce09a5068b2055094b2ed" Subject: Re: [PHP-DEV] Parameter type widening RFC From: me@kelunik.com (Niklas Keller) --001a113ce09a5068b2055094b2ed Content-Type: text/plain; charset="UTF-8" 2017-05-28 12:30 GMT+02:00 Rasmus Schultz : > > > 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. > Where does it state that? (The "true" in the future scope section should probably be replaced with "full".) > 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. > How does this *remove* expected behavior? Could you show a concrete example of code that breaks? > 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? > Correct, but not just for interfaces. > To me, that's "broken". > As said, please show a concrete example that breaks. > 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. > No, interfaces exist to guarantee the caller can always pass a type XY there. With type constraints removed in a subclass, this guarantee does not break. > 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. You're, again, ignoring one of the major benefits of the RFC: Being able to move from explicit type checks to type declarations without breaking subclasses. > > 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. > You haven't pointed out a real problem, yet. Regards, Niklas --001a113ce09a5068b2055094b2ed--