Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99134 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22532 invoked from network); 23 May 2017 20:46:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 May 2017 20:46:58 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.160 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.160 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.160] ([81.169.146.160:14630] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 88/53-10292-FBF94295 for ; Tue, 23 May 2017 16:46:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1495572411; l=6718; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=geOt3Z0NHanT3cgFuA9mR7oWMx9jgYy/4OOjkgkewY8=; b=MsQvaLELfUBO/ljFkbbvmaa25f70OgH41beSN/wkB13Yb1YYRoc+6FCobAVqAg9KML jGenjFCVKORe9n9o0sprFz7SveFzpVI+qYEV/Uz+lBqvWIN5XdJpqfduM98SLLnxwv9Q eO8tFbl9GUZzlgDIcGH1KAH74fq/RGXTblJtk= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoNHBqX83Q== X-RZG-CLASS-ID: mo00 Received: by mail-oi0-f44.google.com with SMTP id l18so217419326oig.2 for ; Tue, 23 May 2017 13:46:51 -0700 (PDT) X-Gm-Message-State: AODbwcB9Tx3dY8GzbKaP5+jjz4C3rWo+sM4SGqZSxllkTEXsvyrDRxjr qRM3DPJRTRzeGmQaoO3QhsSFWuPDYA== X-Received: by 10.157.46.234 with SMTP id w97mr2508930ota.78.1495572410826; Tue, 23 May 2017 13:46:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.176.133 with HTTP; Tue, 23 May 2017 13:46:50 -0700 (PDT) In-Reply-To: References: Date: Tue, 23 May 2017 22:46:50 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Rasmus Schultz Cc: PHP internals Content-Type: multipart/alternative; boundary="001a114639d0488a0d0550371633" Subject: Re: [PHP-DEV] Parameter type widening RFC From: me@kelunik.com (Niklas Keller) --001a114639d0488a0d0550371633 Content-Type: text/plain; charset="UTF-8" Hi Rasmus, > This parameter type widening RFC, I didn't know about, but I have a remark. > > The feature, as implemented, will allow accidental omission of type-hints, > will it not? > Yes, correct. > Previously, the implements keyword guaranteed a correctly type-hinted > implementation - it's now possible to (purposefully, obviously, in certain > rare cases) omit type-hints by accident, making the implements keyword much > less (or not any) of a guarantee that the interface is implemented > correctly. > The interface will just work correctly, what's the actual problem you're seeing? > The addition of an explicit "mixed" or "any" pseudo-type would have made > this possible, without losing the guarantee that the implements keyword > used to provide - that is, it would have been possible to have this feature > for the few cases where it's useful, without affecting safety in the > majority of other cases where it's not. > > I feel like this feature takes a pretty dangerous shortcut by simply > removing a constraint check that we used to have - in favor of supporting a > few rare cases, we removed a guarantee that interfaces and the > implements-keyword has always provided. > > Those rare cases could have been supported in a safe manner by introducing > a "mixed" or "any" type, which would have made the use of this feature > explicit - which would have removed the risk of accidental omission of > type-hints in the majority of cases. > Unfortunately, that doesn't work for the second (maybe even primary) use case of the RFC: Adding types to a class isn't a BC break anymore with the RFC, as child classes will just widen the type and need explicit checks as before. Without the RFC or with a version with "mixed" or "any", method signatures will be incompatible again and thus be a BC break when adding types to the base class. "mixed" has been mentioned in the original discussion, but there was not a lot of interest and mostly explicit disinterest. > The RFC page doesn't link to any discussion, and the Github thread was shut > down after some negative remarks. > > I didn't see a discussion or a vote here on internals - did I miss > something? Where or how did this get discussed and passed? Are these > discussions happening somewhere else besides internals now? - Original discussion: https://externals.io/thread/505 - Vote announcement: https://externals.io/thread/613 - Vote resumption after internals having issues: https://externals.io/thread/619 Regards, Niklas --001a114639d0488a0d0550371633--