Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:125124
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 9B3F71A00BD
	for <internals@lists.php.net>; Fri, 23 Aug 2024 11:49:20 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1724413871; bh=i1eU6Ws9pq6oeUHtaNQl9QnnPqPNThPRYLb3obH197Y=;
	h=References:In-Reply-To:From:Date:Subject:To:From;
	b=PBqKidVX9bCGDiK9YlOqXFiH43FDSmJTJG1l6OxxiQVM+tqLTvrrMYwE5KKMQ3G4p
	 2q9sryd4ZwEKJmCRfFrjkOSQ7msUS1p0RcgXTiLkh7c4l1UH/LD/aEc2pEVQDH3d+I
	 nh7gbmq5AjPkUlNUBzqJnc35DinUphhfEimcUYS5zlgjaj+Fy3D/c5SMKKuKyQbeco
	 21ztcTJVZLHvbtMTbHomIzZ2AAO3LJLcNwa7Xgdum5xB+XxyQu3T/o9HI2oRtwJWKp
	 dYmr2tZBFhwJ6q1uJ4W4vZQ9kbzKaYQUxdat9XOlm/x+RITPt3hvGuZMCRGKCSoBEf
	 nW/x5iGh0vVPQ==
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id BD3DC180054
	for <internals@lists.php.net>; Fri, 23 Aug 2024 11:51:10 +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,DMARC_PASS,SPF_HELO_NONE,SPF_PASS
	autolearn=no autolearn_force=no version=4.0.0
X-Spam-Virus: No
X-Envelope-From: <SRS0=ca34=PW=thephp.foundation=roman.pronskiy@fe-bounces.thephp.foundation>
Received: from smtp.forwardemail.net (smtp.forwardemail.net [164.92.70.200])
	(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 <internals@lists.php.net>; Fri, 23 Aug 2024 11:51:09 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thephp.foundation;
 h=Content-Transfer-Encoding: Content-Type: To: Subject: Message-ID: Date:
 From: In-Reply-To: References: MIME-Version; q=dns/txt; s=fe-91d4c3a6d5;
 t=1724413758; bh=i1eU6Ws9pq6oeUHtaNQl9QnnPqPNThPRYLb3obH197Y=;
 b=ijvq8WSKJvEHawhPVPlfJUeXQEg9Yr8171skcvTqKFToMNPqPCKyCRfrGF++oVp5NfHklQEy4
 lJ6mW08UnMsG6A9KdouF2Y/XIU8xWjjfScl6ak0DkqW8vgBvfNqefc/lrE/SB0OZzBRL0XP2ath
 hP4g9N/oeyxzpWsmjS/iurE=
Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-202146e93f6so18705955ad.3
        for <internals@lists.php.net>; Fri, 23 Aug 2024 04:49:15 -0700 (PDT)
X-Gm-Message-State: AOJu0YzgeZ3vOdywfYsi5hGfvn42fN4fSn0dmujSaP8PbskeI/MrMGmw
	LsXnEJ4eUxwA29kpDlwLPwmDc7EXAa8ODzF9ZanHqkWq2SlwJTFfyHPbNBR8KumzYutdJ8Uhi9x
	5u/qV0g1ll0oO67Z6ZRRqAyq1nUwvtwZT1gEG
X-Google-Smtp-Source: AGHT+IGpzPgKy/BrJlxpyf3ROGaItA+TxX6pRwXaN3s4MOZw8DxdYpSn1HspSEmcJbzMw54khW1OU95iqJvaVpTYlhA=
X-Received: by 2002:a17:90b:4c06:b0:2d3:90e1:41c7 with SMTP id
 98e67ed59e1d1-2d646d3040emr1868909a91.31.1724413754588; Fri, 23 Aug 2024
 04:49:14 -0700 (PDT)
Precedence: bulk
list-help: <mailto:internals+help@lists.php.net
list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net>
list-post: <mailto:internals@lists.php.net>
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: <1b59392a-68cb-36eb-0fef-977ac7113520@php.net>
Date: Fri, 23 Aug 2024 13:48:58 +0200
X-Gmail-Original-Message-ID: <CADZ9LSXN-_oSUumwXmka7xgEy9PsEjUn+O4YGPP-2QPwyaB5_g@mail.gmail.com>
Message-ID: <CADZ9LSXN-_oSUumwXmka7xgEy9PsEjUn+O4YGPP-2QPwyaB5_g@mail.gmail.com>
Subject: Re: [PHP-DEV] State of Generics and Collections
To: PHP Developers Mailing List <internals@lists.php.net>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Report-Abuse-To: abuse@forwardemail.net
X-Report-Abuse: abuse@forwardemail.net
X-Complaints-To: abuse@forwardemail.net
X-ForwardEmail-Version: 0.4.40
X-ForwardEmail-Sender: rfc822; roman.pronskiy@thephp.foundation,
 smtp.forwardemail.net, 164.92.70.200
X-ForwardEmail-ID: 66c8773bc4a7ae43a3495686
From: roman.pronskiy@thephp.foundation (Roman Pronskiy)

On Mon, Aug 19, 2024 at 7:11=E2=80=AFPM Derick Rethans <derick@php.net> wro=
te:
>
> Arnaud, Larry, and I have been working on an article describing the
> state of generics and collections, and related "experiments".
>
> You can find this article on the PHP Foundation's Blog:
> https://thephp.foundation/blog/2024/08/19/state-of-generics-and-collectio=
ns/

Thank you Arnaud, Derick, Larry for the article.

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