Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121401 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 84590 invoked from network); 18 Oct 2023 15:44:03 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Oct 2023 15:44:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 473C51804B0 for ; Wed, 18 Oct 2023 08:44:02 -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=-1.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, KHOP_HELO_FCRDNS,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS16276 192.99.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from mail.processus.org (ns563681.ip-192-99-44.net [192.99.44.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 18 Oct 2023 08:44:01 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------0FrLCGFuxSD7vZwZtVnTwcD1" Authentication-Results: mail.processus.org; auth=pass smtp.mailfrom=pierre-php@processus.org Message-ID: Date: Wed, 18 Oct 2023 17:43:55 +0200 MIME-Version: 1.0 Content-Language: en-US To: Robert Landers , Deleu Cc: =?UTF-8?Q?Olle_H=C3=A4rstedt?= , Rowan Tommins , internals@lists.php.net References: <9d5388fa-a5a5-4fa5-81ff-16f6670f80b6@gmail.com> In-Reply-To: X-Spamd-Bar: / Subject: Re: [PHP-DEV] Previous discussions about generics syntax only? From: pierre-php@processus.org (Pierre) --------------0FrLCGFuxSD7vZwZtVnTwcD1 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 18/10/2023 à 17:37, Robert Landers a écrit : > That is all I want whenever I think of Generics in PHP. The rest is > just complicated fluff in my humble opinion. Where I respectfully disagree is about exactly this: you would appreciate array, I would very much appreciate SomeDoctrineRepository so that my IDE would actually give me the right autocompletion. There's also another use where it would get even better: ``` EntityManager::find(Query): T class SomeQuery implements Query {} // Later in code: $someEntity = $entityManager->get(new SomeQuery()) assert($someEntity instanceof T); // Is now useless, my IDE simply knows. ``` There are many simple use case that can make our life easier, outside of simply array, lists, vectors etc... Even if type erasure is done and there no runtime checks, it would greatly help when correctly done at the right place by userland APIs. ORM's are one place, but there are many others. Regards, -- Pierre --------------0FrLCGFuxSD7vZwZtVnTwcD1--