Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111890 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 18434 invoked from network); 17 Sep 2020 18:22:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Sep 2020 18:22:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 96ACC180598 for ; Thu, 17 Sep 2020 10:30:48 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from srv015.mail.ichtushosting.com (srv015.mail.ichtushosting.com [159.69.182.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 17 Sep 2020 10:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stitcher.io ; s=default; h=To:References:Message-Id:Content-Transfer-Encoding:Cc:Date: In-Reply-To:From:Subject:Mime-Version:Content-Type:Sender:Reply-To:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=TrilT/CISFp5DlVb7fG1I3Oc6rpFGdqkLabFBpGuw1g=; b=H6VFBmMUVHiqOKslxU6HkF8362 BopnAqrx/P06TpAwHr9Zhyzn9FzZbyp+3/r2Hb228c6lqYvG2iPoxHFs0pi8ApNiGgCQ8Lb1idlrp o7Wgcd3qZhRxdj0WsW7DSka+nVyYh8Hywt+XJWL6XHI7kT4otvVn7CrUVaXf5Pck7JCTCiDr19+xO rSp9D+RSMYKHDzVv/oYNl8YTpNSRuFNYggMH4goRrJaKKIoOJbmaMuaNPfG5niHZQS2NKksSian4z ZDtUEMOCsLZWJcSNaUXyCHVo6dnyryxnW/cramlEPMhAHwH/I1otrYAqHlZNF6LiWh90nSVZmpRRd zHLL3Amg==; Received: from srv020.mail.ichtushosting.com ([78.46.213.219]) by srv015.mail.ichtushosting.com stage1 with esmtp (Exim MailCleaner) id 1kIxk6-0007fi-9z from ; Thu, 17 Sep 2020 19:30:46 +0200 Received: from ptr-fq9pjpjoj2u95w9lb54.18120a2.ip6.access.telenet.be (ptr-fq9pjpjoj2u95w9lb54.18120a2.ip6.access.telenet.be [IPv6:2a02:1812:c3c:3a00:edce:f36d:6feb:e4a8]) (Authenticated sender: brendt@stitcher.io) by srv020.mail.ichtushosting.com (Postfix) with ESMTPSA id E4D803EBDA; Thu, 17 Sep 2020 19:30:45 +0200 (CEST) X-MailCleaner-return_path: brendt@stitcher.io X-MailCleaner-sender_address: brendt@stitcher.io X-MailCleaner-recipients: tovilo.ilija@gmail.com, internals@lists.php.net X-MailCleaner-SPF: pass Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) In-Reply-To: Date: Thu, 17 Sep 2020 19:30:45 +0200 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <736887E5-1015-4909-9087-274E69C75960@stitcher.io> References: <09DE673B-71B7-4C8E-A795-900B51F8E476@stitcher.io> To: Ilija Tovilo X-Mailer: Apple Mail (2.3608.80.23.2.2) X-MailCleaner-TrustedIPs: Ok Subject: Re: [PHP-DEV] The case for transpiled generics From: brendt@stitcher.io (Brent Roose) Hi Ilija > On 17 Sep 2020, at 19:01, Ilija Tovilo wrote: >=20 > Hi Brent >=20 >> Today I'd like to hear your thoughts on what might be a controversial = topic, though I think it's worth having this discussion. I want to make = the case for adding generic syntax, without actually enforing any = additional type checks at runtime. Please hear me out. >=20 > I think having the option to omit runtime type checks could be > valuable even for non-generic code. If your own internal classes all > use static analysis the chance of passing a wrong type is pretty low. > This would probably have to be on a per class or even per function > basis as you can't reason about other people's code. I agree, if there's enough interest in this, we might need to consider = the scope of one or several RFCs. >=20 > I do think we need some form of generic runtime check. If we don't, > how generics work is completely open to interpretation. Static > analysis tools copy the behavior of PHP. If PHP has no behavior in > this regard tools will deviate and generics won't have any real > meaning at all. There are many nuances to generics (ask Matthew who > wrote Psalm), we shouldn't underestimate that. With a hybrid approach > we could also do full type checking in testing environments and > disable it in more performance critical situations with more > confidence. Larry also shared this concern, and I agree that it's important to at = least have an official spec from the PHP project. Whether part of it = should be enforced at runtime is up for debate, but it's definitely = important. >=20 > Ilija >=20 > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php >=20 Kind regards Brent