Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119483 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 95550 invoked from network); 8 Feb 2023 00:13:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Feb 2023 00:13:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7A8B5180547 for ; Tue, 7 Feb 2023 16:13:12 -0800 (PST) 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.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8075 40.104.0.0/14 X-Spam-Virus: No X-Envelope-From: Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2076.outbound.protection.outlook.com [40.107.94.76]) (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 ; Tue, 7 Feb 2023 16:13:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lqiG1cbjh6s0I8fdMeTUFyUisd0fESI0UwhQz/7ucSdVyg1wPzQcgJeTbKjZdf3y7RaHYmChH+wp67+5Pk2wLLoPm7sBtwPatSgXjquUabdzItdvlXb6V5CZzYQ7MB723Wxp7wVv4rUrz+1V/8MLh4HA0xZXeEGtERRJ0J64iXgJun1Xb3VcuwLH3aUhgwbBbGm0HAAbhnEapgktm73AdgBTJIhaEzX8L1LBD0JW5rwlBNKouDwfcilCridequbRaRTrlefYvza3SxETY9QZO2AnFxLEFaRx3Me7EIU6XE+AZg4oWh1TTtRJ3IfKGEy08Y/PIL4MkrQZyORvxQcwhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4Cf65rQZnN/urLfv0FtZfAJAOtesXo1OfKbmedCFW10=; b=k5+YQfgOeVT5iorrIBT75UoYL40Sb9kQwZovkV0mmw9v8XH6qGg0JJ1x0odGah7UzVtsLIaxSrtMx+Umf8MYbJP4g/j6hFLRVF1DjFL0tfEfyyToUpe2hHL7e2FGUmpB7qWKS7Ckm3G6cydnRzDuG50h0zESV0n99SoAuGgEwqGOebvhauysqS1QiH2a2q+AB6ncVMDUsunkyrcnqeSU5x0al7W5R0q0/KB6SdSNfxOrGb/HIEhRVRuhYC/xb4kTOT320vY0Kh/Zwd8UNB1U5H/nA4Ct5LFeLx/j4uPV8UHXd/TZ6+Poom5di//rPhTxAIvLmhxUfR8ErLDcS1ex4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=shymko.net; dmarc=pass action=none header.from=shymko.net; dkim=pass header.d=shymko.net; arc=none Received: from PH8PR10MB6337.namprd10.prod.outlook.com (2603:10b6:510:1cc::10) by SA3PR10MB7094.namprd10.prod.outlook.com (2603:10b6:806:31b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.11; Wed, 8 Feb 2023 00:13:08 +0000 Received: from PH8PR10MB6337.namprd10.prod.outlook.com ([fe80::ed95:e287:42b3:6a2d]) by PH8PR10MB6337.namprd10.prod.outlook.com ([fe80::ed95:e287:42b3:6a2d%7]) with mapi id 15.20.6086.014; Wed, 8 Feb 2023 00:13:08 +0000 To: PHP Internals Thread-Topic: [PHP-DEV] RFC Proposal - Types for Inline Variables Thread-Index: AQHZOlX7YKTWLhw+WUefsH/0v26wAa7Ca52AgADvWYCAAFD9MYAAOzeAgABB0sU= Date: Wed, 8 Feb 2023 00:13:08 +0000 Message-ID: References: <18627e9c82d.1185ba82a2669697.6762525826203739336@wendelladriel.com> <8c3fb742-4367-0e4a-b96e-142657ac902c@gmail.com> <5edaa45e-08ff-9529-3a1b-42f655a68497@gmail.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=shymko.net; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH8PR10MB6337:EE_|SA3PR10MB7094:EE_ x-ms-office365-filtering-correlation-id: 3eeb4ef7-3180-4485-907e-08db096941bf x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: X/koCMBkxTlTYCZRzikEFgWcGuIJeg9Ce3rrKRRb+XQTZlfnYqUxIc5YHI5YlvL3hlQDXqVBHxPeFmh1GgXAu2IGRhTt0dgqjbHAut7AGdmRqsa5MAap4U0gmqHpVZ7q8yq1cpVgoXrE74nggLUyvRwTC7oZP6N8Zjgz63Fs6Wu1NaNBsl20/QRqav2lh5/SA62CfXOsL4UMOpS/K24g9ueJhvTDUvJFZyhhPot4ZI0PyRrGtYtrZQrA6Ei+/PzpqBmKHgggjJ00s5lTK6Qz6YKuaCYT2sfGqxAYhlDk/tgII40C257Br3DvMvxuG/wKESXeTLTsJYltf3pudpKM/4mV3/+CiDfk4AGzUoai7Vu5L7z+T/CeYK0kgq2qVjkgnx3tDdsCbTqZuk5lPlJ1tJd/54IjByvHohlLMyPdAse357oFEKlAJkfwbWRgorG3geFqjTeX3m5S5BQi9j3n8ZduSyqxz1RHXSCzrJk0t0B7Z1OsvLnKKOSiUmh2VRiZ/RuaNsPYrzBQW31RtArOkmLhItVq26z5E+y8ZpMhi5omYVRAkjD2E16vFH7nkytuptQT1DnVtDXioQRqn/EAEFrnPAVuC2XIUlFIfh0i9YsUXGViIpg9YiQInYyQicYCZqMHJBLFu9Alfj+ddce+aT++K8RDtPm112UHGxKTjeKLEeiPSxS5VgYkgNTsqKiv749mW9RMkBWUbqOgnKRozxWUj3Xh32FFlP/lSh6fOLI= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH8PR10MB6337.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(396003)(136003)(39830400003)(346002)(376002)(366004)(451199018)(478600001)(16799955002)(53546011)(38070700005)(83380400001)(122000001)(33656002)(55016003)(166002)(38100700002)(6506007)(26005)(9686003)(86362001)(186003)(52536014)(8936002)(64756008)(66476007)(8676002)(41300700001)(2906002)(6916009)(66446008)(19627405001)(5660300002)(71200400001)(66556008)(7696005)(316002)(66899018)(76116006)(66946007)(966005)(91956017);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?nP3EPbbg3FBLeYrQ8ju545u6oMLjteJRB3/3BSTKNWzmIW+m20zFUsrBHq?= =?iso-8859-1?Q?GFxC0OjhwmuNi2mlFyOgamiP/r8v/isR+sz8TsgK2r2779bWxUOk+cUQZt?= =?iso-8859-1?Q?gORkAQw2Gng8GKSonDjbt5JK632bqMi4f514TFfkOC4UT++uQAn6Gk4WNN?= =?iso-8859-1?Q?xnFTJ4yJQ0wvkgT4xbWoDWlxjM1bUD10kECZ5sumigK4+xeGo6S1QHk9u1?= =?iso-8859-1?Q?hooA6D4M8ZEE36ClV77WxsC5rTSFPKrPY8Ehpp+cLfqrcy+pO2AHgSUMHD?= =?iso-8859-1?Q?+X6cDXlAaRQ7YfU84Xj8RhAhdXba7XfwzvEyA1FDtUTKvlbkTb95q2hV4y?= =?iso-8859-1?Q?F8TqN54QKqUxY30bhYz8IDyWDSuUSPDasjLPPvqoN20yxP2EbzT+PTRADx?= =?iso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GE13EAkt7jk3fHeTAbHRTY9mbPycPZyV10Re?= =?iso-8859-1?Q?FYiwAlGnHR294HDRR/HuNgOhhpBksLg0SnQTfmQMDZNTaYMuTGWE2VO/06?= =?iso-8859-1?Q?MmNWXHYX5ippvyquNx+SJ2YvaNp77m6z7a6N1exuKfdNCDyUJTeizVmv+B?= =?iso-8859-1?Q?ytOI6SoiuIyewkIS9s+/qsOjdsqCVeo/YrwURCJAhL+K4qNzPIc4nIqtw+?= =?iso-8859-1?Q?x523aV07pM5L49ltMPLfh9egUNpWrUyhvJYhX2/k2tFEwD2RpTl3dqRquS?= =?iso-8859-1?Q?2NkQ4f5S0so572KRzjxtd4ESIpFbEQY60kMXs4VMWjRSgqRc7X/Wug8fTL?= =?iso-8859-1?Q?m9OtShBtu5li8=3D?= Content-Type: multipart/alternative; boundary="_000_PH8PR10MB63376623B7E735DB70B594B1BFDB9PH8PR10MB6337namp_" MIME-Version: 1.0 X-OriginatorOrg: shymko.net X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH8PR10MB6337.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3eeb4ef7-3180-4485-907e-08db096941bf X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Feb 2023 00:13:08.1875 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d7878c48-41c7-48dd-bd7e-899af7355b7e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4xO3iUMb8KqmZgBrN3Rv4pcgJ6SZ+wGO8vnuO1cD6eEGeaHbNJZLLvmVixcQ2U6MaU6tD5sD9PP2D79sGXN0Yg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR10MB7094 Subject: Re: [PHP-DEV] RFC Proposal - Types for Inline Variables From: sergey@shymko.net (Sergii Shymko) --_000_PH8PR10MB63376623B7E735DB70B594B1BFDB9PH8PR10MB6337namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable ________________________________ From: Olle H=E4rstedt Sent: Tuesday, February 7, 2023 11:53 AM To: Rowan Tommins Cc: PHP Internals Subject: Re: [PHP-DEV] RFC Proposal - Types for Inline Variables 2023-02-07 17:21 GMT+01:00, Rowan Tommins : > On 07/02/2023 14:07, Olle H=E4rstedt wrote: >> It should perhaps be mentioned that analyzers can use type annotations >> during their process, instead of the more clunky /** @var string */ or >> similar you have to use today for local variables. > > This sounds like you're reaching for Python's approach, where the > language "supports" the type annotation syntax, but doesn't actually do > anything with it. No not really. I'd expect it behave similar to function argument type-hinting in PHP, that is, runtime checks, but where the notation can be used by external tools. Olle -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php Hi, Wanted to add my two cents on potential usefulness of typed variables. I think, typed variables would be a necessary prerequisite for typed arrays= and eventually generics. If my understanding is correct, the primary concern there is performance ov= erhead of iterating items for type checking. With typed variables, type checking is done at assignment and passing typed= array around becomes lightweight. It would be enough to type check against a known array item type without it= erating over items. For example: function do_something(array $strings) { ... } array $names =3D ['John', 'Jane', 'Jake']; // items are type check= ed similar to variadic argument unpacking sort($names); do_something($names); // lightweight type check as for scalar types (I'm a recent mailing list subscriber and have no RFC voting rights whatsoe= ver). +1 to the proposal as it would nicely complete the type system of PHP. It's pretty odd to have typed arguments and properties, but not variables. Moving one step closer to retiring PHPDocs for good is very good as well. --_000_PH8PR10MB63376623B7E735DB70B594B1BFDB9PH8PR10MB6337namp_--