Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127421 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 lists.php.net (Postfix) with ESMTPS id AC2921A00BC for ; Thu, 22 May 2025 06:17:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747894513; bh=ThYIaNxzMLDh0nLIpserQIpqhRDLweYU92zk+7sv3a8=; h=From:Date:Subject:To:From; b=FAwbJX+cT7BIvs6uXl6aSk6v5F+5LHMfaMDQHKycz6a7SHnhLFUnli7sa8bIZHF+H QmbKjhR+RtZLgd7EVT5CSPkQiicgjNTbV3FwiI7BOnOTgrv818vHRzrHXJe0ILo7cO Yy5fVLm+d7oFtLV22DVb6ma1uLPrhM0Ksrm/Dmx/IrJeM8TPiJ9rdgtKdKpycN0NVD iyxGdTtLOR2xX6ok2VmD6QncXl22Npxu0JV/YRwyxLUwGVrvzHq9Mr8qHo2eKvj13j FPRZOVWKtUPUaL5IjDxG3UjC4sMmLGLT7hv81+UlEO6I8FMtN5FyVVC4UMFZAhLlQn 94ZqWe0aU7NaQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 29356180051 for ; Thu, 22 May 2025 06:15:13 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,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: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 ; Thu, 22 May 2025 06:15:12 +0000 (UTC) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-442ccf0e1b3so95169495e9.3 for ; Wed, 21 May 2025 23:17:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747894639; x=1748499439; darn=lists.php.net; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=KUwSR8NYTRa35yUZFwqrOCQ+7qeRDPqoAxJgtsyphug=; b=mGxCVQe3Cv150QyL1L3m1AcLjyW0BZFKkFOd68D+eAVa537kdno8O7TyU/TxfgkwZE 8EvESjE8ocLsVlVI46EM/t1f6czAGf8eapSuJaKy/gO6qKg6C+m7uqLWXdKXJy2dDaXj ycV/+jZH31jQIyrWJvA9AVeI46c/0sA+jQjjSJqNMH/h+oj+i6kfFyWohHVGpu7gKZKY kkE+RKYvyggwTWGLAxyxUi9YxFkF+IfRZVV1Gcvm4JjoPi53f/L/1pYE3Mns6GoRLvsZ 3vAN2tYmPQ5Y6H3Qw8S/bcpNZp+RA5B+wQStt+GtRCrl/011q0Ym90I4OYXFpy1zO0vX SdUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747894639; x=1748499439; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=KUwSR8NYTRa35yUZFwqrOCQ+7qeRDPqoAxJgtsyphug=; b=bUDeRyzaoF7bHkWyWgV603yGFipE5I3o7KEj0vB2Ty+3okMMwTqqHltO01QWAv9QQu VnAjmrBgec6IPaIEH6aZzvEEXyIASM2hFSDhDTHK09g2lCwsy5bbUlbuLubkBDNsjnRo exZ5pKbZfzyxgHVh4QuzZexgRUKZqDtVjfYnM0cvIOEZtO9qLOoHyA0KipZfjDJHKfxY tVAVV5Yhi1Ae2QBrWEV5OauPVt1fBVKHE8XbUFgZcfbGqqduFZqk+84BkbFxj/aMAw1k 4TWuyXIdHIKMqzV0rnc0zkrzgQT6V/WXYu21ScsFe17cX725SJyml2+cjNZauu7ykeLQ HKKw== X-Gm-Message-State: AOJu0YxqhibepT51qrCA6rgSQkIYXGCKthVR9jADSvWH+6lXrpxz3c7C sW7W5L7c3v/HHoGrgx+om0ZMibdoEuTYGzWXb7+BkuzrOXsEwsh7fdWcoABarSBMG9J9bQC9eBM 8X4IBKZ9ayhhBnTS4hIb93N7iK9vZHJpEH47v X-Gm-Gg: ASbGnctZv5Yi88TKox5DFrsL7mdaDEQbztP1/uyjeK6OuPS14pvDC/J9K1HcNnH0for UfZDDj69zfuikvuSrt8blV6wrpFLmZoJRKiY17d+7tsjM8vTpzVB+22yYSJHhYEJYZon0ZLvyhO 35qwekZsYulnqrrzkh5W+c78zOvI2C6hG1bg== X-Google-Smtp-Source: AGHT+IHtJ6UE50GZpx6PBywLNEbXbpJVVFCKJ2Cq3/DTyUwkoEuUw7ls57qT1PXDErAxNmlvMBGk5VhPQQwoC0MvreM= X-Received: by 2002:a05:600c:3554:b0:442:ccfa:fa with SMTP id 5b1f17b1804b1-442fd671f7emr224920845e9.27.1747894639302; Wed, 21 May 2025 23:17:19 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Thu, 22 May 2025 09:16:43 +0300 X-Gm-Features: AX0GCFu_xworVMA2mfEZv_OlhotiiChcV_3D5imVJe7_lPyiN-SFZOMFBc83HQE Message-ID: Subject: [PHP-DEV] Generics - Userland implementation via attributes (released today). Discussion and seeking advice for improvement To: PHP internals Content-Type: multipart/alternative; boundary="000000000000149af40635b36f2b" From: arvids.godjuks@gmail.com (Arvids Godjuks) --000000000000149af40635b36f2b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Internals! My friend Grigory has cooked up an exciting package implementing generics with full runtime type checking in userland. I honestly believe it can be surpassed only by doing a full native implementation (which we know is fairly unfeasible from Nikita's previous research), it's transparent to the PHP code (if disabled, the code will still run just fine), is pretty light performance impact wise and requires zero pre and post processing (aka "compiling") of the code. It's as transparent for the developers as possible. https://packagist.org/packages/grikdotnet/generics https://github.com/grikdotnet/generics List on what's implemented and what is possible: https://github.com/grikdotnet/generics/blob/master/documentation/story.md#i= mplemented The documentation folder contains quite a bit of information :) I'm posting this to internals for the following reasons: - * Seeking advice and know-how on how to improve performance - * Ideas on making the syntax better - * Explore the possibility of making changes to the PHP engine - Improve performance - Support extended syntax in the attributes like #[\Generics\T(Collection)] so it doesn't have to be = a string that needs to be parsed as it's now - Return type attributes? - How about having a built in generics empowering attribute that userland libraries can take advantage off and do implementations? - Having an extended discussion of the feature and where it can be taken going forward - Seeking help with implementing missing features, code review, etc Grigory has signed up to the list, so you can direct all the questions in the thread to him :) Sincerely, Arv=C4=ABds Godjuks +371 26 851 664 arvids.godjuks@gmail.com Telegram: @psihius https://t.me/psihius --000000000000149af40635b36f2b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello Internals!

My friend G= rigory has cooked up an exciting package implementing generics with full ru= ntime type checking in userland.=C2=A0
I honestly believe it can = be surpassed only by doing a full native implementation (which we know is f= airly unfeasible from Nikita's previous research), it's transparent= to the PHP code (if disabled, the code will still run just fine), is prett= y light performance impact wise and requires zero pre and post processing (= aka "compiling") of the code. It's as transparent for the dev= elopers as possible.


The documentation folder contains quite a bit of in= formation :)

I'm posting this to internals for= the following reasons:
  • * Seeking advice and know-how on = how to improve performance
  • * Ideas on making the syntax better
  • =
  • * Explore the possibility of making changes to the PHP engine=C2=A0
    • Improve performance
    • Support extended syntax in the attribu= tes like=C2=A0#[\Generics\T(Collection<int><float>)] so it does= n't have to be a string that needs to be parsed as it's now
    • Return type attributes?
    • How about having a built in generics empow= ering attribute that userland libraries can take advantage off and do imple= mentations?
  • Having an extended discussion of the feature and w= here it can be taken going forward
  • Seeking help with implementing m= issing features, code review, etc
Grigory has signed up to th= e list, so you can direct all the questions in the thread to him :)

Sincerely,
Arv=C4=ABds Godjuks
+3= 71 26 851 664
Telegram: @psihius=C2=A0= https://t.me/psihius=
--000000000000149af40635b36f2b--