Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125128 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id B45431ADA7E for ; Fri, 23 Aug 2024 12:05:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724414813; bh=NQEnSu5LMf87GJxj6K/bav/GtpcLCdgbgge76w5MRAY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=e8Tw91aCheAA59m4xnlym7fg6iwBNfWWA+KG1AuiWBaIDRFxy5GUgvkELvzlyqvJ/ KXAhPynw8rAF4B3Pc/ZRIiBfOMGSAGP4UyNZ062JfHIA5Vak+AGN40xG/EBcDoQ2Lq tYRFSPaVTlqu8X0Y8xf9bOaor7gcncJfl3O74P7sEf1A6raHdjQKJeOXJIogSifY6i ZcI2gYu2BIa2++lPZi0+ZCld0ARHRAXim+M1UU9Oao6Elr8ran/XxNwErWD2NfEmSK AN+H9OfNSPLUXqnHC54gj3sLtf0+Mh0zpFHuv+I9LqAPKAD6ZcaWKeVhhr8TeF9Ucw 3Na/UblzIyPEQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D461B180084 for ; Fri, 23 Aug 2024 12:06:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,MIME_BOUND_DIGITS_15,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com [209.85.128.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 23 Aug 2024 12:06:48 +0000 (UTC) Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-6bcde7538a2so1109627b3.3 for ; Fri, 23 Aug 2024 05:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724414697; x=1725019497; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=NQEnSu5LMf87GJxj6K/bav/GtpcLCdgbgge76w5MRAY=; b=GolniBOOl54xlyyiX9msqZw4riAtzbA26GKO5yLJ+nPJod2dPo5+ZeltuACDZ8jZCi VoMHf0M7T0KZufxOfIkY8LbyHEM9ZjYYh8eoRjia1b6cpDi3sDBiXabZCzrALiztVPTA /J9ZD7ayH2SZovhiD2FvwbB/X6CQ1ohJP8xi/mckBVRVCSRKYiMfbLIPlm7ePqI+ugV0 TZN/3xl0yz3uNB4ImpCk1Em+DiGzx8V7qojP3GRdLQau6d6Syxr6MUzUP4DNQ/cOdiTT X9OMMurT5KVEXeZYsz+9ZtaPgfEPlJpF1Cv2KF2Yq66CNhcnp8kPy536zq8JpabLo16k uaPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724414697; x=1725019497; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NQEnSu5LMf87GJxj6K/bav/GtpcLCdgbgge76w5MRAY=; b=gL9WpRqGOu19mOqLmemIUtDqynqJuwpcXHymn7S0Ss0wN8A1bl5DevBqBkjOdhNC4f ENewC+cBhoyoN0KniPmfgHfTw/MEh+LzR2bAjUEJSlaJb3J/74c8S47/DLxrtGHrBCST Ua6V9FSly11Kxw/z6YQsETCiH+RrA7ruZgqxR2YZj7Xmin2xd/r2Y+jDPFNL1GJnRXD7 cHjhMAjZIAeYFCxJAB9cRvYFrv6UKQznOfiob7KvaFHx2rR8rq6oVMAMiRZ58S2LFpe3 e+yIMETQ0y9Oaqia0Kgh9kEieAf7fJpk0EVw+UWi5A24XHZEHJ/v3IGOKxzQEJaUv7Hs hgow== X-Gm-Message-State: AOJu0YxAfEk3GWdX14TNKywrVS65FSDC9MuCoISejCLIlm7awxxW3oU5 JEwsYTbXlDNKmOxTERXzYQ22UEmAfFg9PSAruggzR+5cw4obN8iOmtU3+Vh6Ya8RYTzuq/FDE9C FTBQ1GdPqNTBwCv/yazyve63u97sgUTOs X-Google-Smtp-Source: AGHT+IGKgrOh6HpuKHMaP/LOGRWpC3SfPySIF9BJNyjQhrDNK7eOI/Ac1jqEAY/cig6K479SZ5w/Uq9NrdpaM+F60WI= X-Received: by 2002:a05:690c:39d:b0:6b3:a6ff:7672 with SMTP id 00721157ae682-6c62943aab5mr9865607b3.5.1724414696757; Fri, 23 Aug 2024 05:04:56 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <1b59392a-68cb-36eb-0fef-977ac7113520@php.net> In-Reply-To: Date: Fri, 23 Aug 2024 09:04:20 -0300 Message-ID: Subject: Re: [PHP-DEV] State of Generics and Collections To: Roman Pronskiy Cc: PHP Developers Mailing List Content-Type: multipart/alternative; boundary="0000000000007221600620589532" From: deleugyn@gmail.com (Deleu) --0000000000007221600620589532 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Aug 23, 2024 at 8:51=E2=80=AFAM Roman Pronskiy wrote: > > Do you consider the path of not adding generics to the core at all? In > fact, this path is implicitly taken during the last years. So maybe it > makes sense to enforce that status quo? > > Potential steps: > - Make the current status quo official by recognizing generics PHPDoc > syntax as The Generics for PHP. Just adding a php.net manual page will > do. > - Recognize Composer as the official PHP tool. It's currently not > mentioned on php.net at all. > - Suggest using PHPStan or Psalm for generics and type checks. > - Add an official specification for generics in the PHP manual to > eliminate semantic variances between tools. > > This will keep the core simple and reduce the maintenance burden, not > increase it. > > Moreover, it does not contradict with any other implementation > mentioned in the article, should they happen. In fact, it could be a > first baby-step for any of them. > > There is also an attempt to do generics via attributes =E2=80=93 > https://github.com/php-static-analysis/attributes =E2=80=93 it could > potentially be a better alternative of recognising =E2=80=9Cofficial=E2= =80=9D syntax, > because unlike PHPDocs, attributes can be available in core and the > syntax is checked. > > What do you folks think? > > -Roman > Seems like a great plan, to be honest. I find it rather odd that Generics is the most requested PHP feature because it seems like we have survived without it for so long and I don't subscribe to the concept that this would be the best thing for PHP since electricity. Having an official "syntax" (Attributes, Docblock) could increase adoption. On the other hand, I feel like a likely outcome is that folks will still consider it as "something that doesn't exist yet" and will keep requesting it. Something else that is worth mentioning, I like that Collection is being discussed as a small step as well. It's a very common use of Generics and would be a great addition to the language if something solid comes out of it. --=20 Marco Deleu --0000000000007221600620589532 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Aug 23, 2024 at 8:51=E2=80=AFAM R= oman Pronskiy <roman.pronskiy@thephp.foundation> wrote:
Do you consider the path of not adding generics to the core at all? In
fact, this path is implicitly taken during the last years. So maybe it
makes sense to enforce that status quo?

Potential steps:
- Make the current status quo official by recognizing generics PHPDoc
syntax as The Generics for PHP. Just adding a php.net manual page will
do.
- Recognize Composer as the official PHP tool. It's currently not
mentioned on php.net at all.
- Suggest using PHPStan or Psalm for generics and type checks.
- Add an official specification for generics in the PHP manual to
eliminate semantic variances between tools.

This will keep the core simple and reduce the maintenance burden, not
increase it.

Moreover, it does not contradict with any other implementation
mentioned in the article, should they happen. In fact, it could be a
first baby-step for any of them.

There is also an attempt to do generics via attributes =E2=80=93
https://github.com/php-static-analysis/attributes =E2=80=93 it could
potentially be a better alternative of recognising =E2=80=9Cofficial=E2=80= =9D syntax,
because unlike PHPDocs, attributes can be available in core and the
syntax is checked.

What do you folks think?

-Roman



--
=
Marco Deleu
<= /div>
--0000000000007221600620589532--