Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110226 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49473 invoked from network); 21 May 2020 02:49:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 May 2020 02:49:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0694C1804C9 for ; Wed, 20 May 2020 18:28:07 -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.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8075 40.64.0.0/10 X-Spam-Virus: No X-Envelope-From: Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-oln040092010011.outbound.protection.outlook.com [40.92.10.11]) (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 ; Wed, 20 May 2020 18:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NMEnx/kMijnYKyVj3Y7ETKUS1XgIGOFbr4Um9VhyLnwET9iVDr6a32KdeRRC4e+fa7wuGhjR95Kxc+om3AZ1kMJ567zIbTbf9Xza4gW7Yf3l0pFfuaThvmJlBA8HjwbaufSH8l8LnXfouvyswGWu2py91cXcpZux3YSEG+kd0g6rIg4v8fPHxTA45GVbMJh8oNgMT+TBSkLlxXi1Va/P00ywTZSdMaDcfFqufVxMxF5hpfxoHKdiCi3BN9ALTQ73r5SBbARCZ5YhF9y1J8LK7yaW5oSPSIP/JssMxAB/i1uLema1WNkvEqm76t1ECc3zy33n1zW4a6SZ/JMZCNKgaQ== 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-SenderADCheck; bh=ImWulGMxBFA+dNev9S47EMGd8H/ugTp0OC1Ph+Q08Jw=; b=mvpguG9FXhx1FxJ/ksIqvcLkfRYLiCBehdm8AzA25CuACB/XQGZV9dV5ToLZZIlaoS1eImeNbPciE3eohEaWejv0xaFrVMGLku+qjiYzFIhIWg20GDC4TFp1+7k4x6vnHoq3tOot8LvIzuESliaGaIWffyI3WSNBJSmAMmSCU6nKaSirTGsiGnQAJXW66gew6R+KUhT3jxFspkmNAJAUWYh1mrV+pjhNz+f5uJQ5A1HF+DFawgQfmsI6vdsUnqRnvGCQZzDVMZ2/Za1QedF2UmC3wRKCxCKC/7FNUlxkWKKYl3gECo18iVwmFF/WZmzQ1DeMCZR+XmJMr/z8k+F6+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ImWulGMxBFA+dNev9S47EMGd8H/ugTp0OC1Ph+Q08Jw=; b=QLZN6K55dgr5rUdxrVZWlUVkeiYHV7f7s1kgA+OZy7rkTdf4/5fN6BDEb6cy6twbW/tJ4V5PksP+g+D6DIludQrpT7Dbz8L0aqZxc+ouL3eAxaSDA2+S0Rq88UAIc72MDbac0A9XoLTTXtJnUrMgi/lyqdDicXp4QgoFtruACAULvree4WYE1rfsBO7ciQmf5NpTG9ueJsXNsdePXR+cLMkAZk5L4XuW2bbD/sceHYh9B2iLESEXMu0Oi1KdXyq0q3QROVYEoOSE7H57IKlJkBHfay9M/PAVj1k4zKA5yj+colP6+8BFYKfeInR1aXqJQRL0OrgTMUEXgkrT2E/Yjg== Received: from SN1NAM04FT039.eop-NAM04.prod.protection.outlook.com (10.152.88.58) by SN1NAM04HT019.eop-NAM04.prod.protection.outlook.com (10.152.89.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19; Thu, 21 May 2020 01:28:04 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com (2a01:111:e400:7e4c::4f) by SN1NAM04FT039.mail.protection.outlook.com (2a01:111:e400:7e4c::242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 01:28:04 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::3054:f599:829e:7dd1]) by DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::3054:f599:829e:7dd1%6]) with mapi id 15.20.3000.034; Thu, 21 May 2020 01:28:04 +0000 To: Dan Ackroyd , PHP internals Thread-Topic: [PHP-DEV] Draft RFC callable types + callable type/function autoloading Thread-Index: AQHWLqax3x5+HtXHVUmJCdckAxA+maixscdx Date: Thu, 21 May 2020 01:28:04 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:E0D8727EB68B2E2AA974ABC009CF97A8DEB8ADCDC433B8A7E35D3C59A89AEF73;UpperCasedChecksum:5DB15A1DD59BFE8BF3BACC2ABF42168601911C20AF5E66F5C8CA95EE8AA5FC8A;SizeAsReceived:7182;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [FsWGCsp+gJtB33aCWnW1JJZ5FGibQMtVa66yBMXkA7+FdRHaRBrKxBU5xpKm6x6w] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: b3d1a443-a0a3-45c9-a63a-08d7fd2635ab x-ms-traffictypediagnostic: SN1NAM04HT019: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lrnC4s40XXftg6QwFimdkDW/sfQdZ9d3LXZB6v9TW5yPdnOw5viSGGaekx4wWByJ5L6XmPLLrW4GXYiJIwJmsj4NZagPuJQp3y/UFBFjw14i9/yp5IhEpAM3yqwoPokxmR/6elR/JPPBKuY56iSW8vISa4Dod5VQO4iyBLJ+6AW3ZnWW4Abd4m7/5OhtX/B9wXEoFRXtKwOnffAUo4BlQY37tg21JUYwWPoLKUN3M2CSmMvsDQDg6gBQnhd5JrP3 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR07MB6618.namprd07.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; x-ms-exchange-antispam-messagedata: jjysKtXrRiWHGmnu9QLt3sm46ePtQfqbqCvaSO8d9dkG+LiXBDWrthBrOijyVj65Z4oW+8nUFE/C8D+CPirG/MGZkbnLdkSBGhJEIU+PcNwwhtGXIG8ZC52V6s1dSLlJjJhTcV0dvahGntaRXh+k64GavP5J7gv7yrCHxOKNfu+HnU8ituTgvMF7Bk822C+ZMfqvZQcsTDloaEHFVKN/Rg== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: b3d1a443-a0a3-45c9-a63a-08d7fd2635ab X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2020 01:28:04.6481 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM04HT019 Subject: Re: [PHP-DEV] Draft RFC callable types + callable type/function autoloading From: tysonandre775@hotmail.com (tyson andre) Hi Dan Ackroyd,=0A= =0A= > Function + callable type autoloading=0A= > https://github.com/Danack/FunctionTypes/blob/master/2_autoloading_part_2.= md=0A= =0A= I'd be happy to see function autoloading support in php overall.=0A= It'd help in avoiding loading unnecessary polyfills, or in large codebases = with many global functions that are only occasionally used.=0A= =0A= Autoloading functions involves a lot of tradeoffs due to design choices in = PHP.=0A= I've seen a lot of different opinions - It might be worth setting up a stra= w poll for whether people would be interested in the change, unless you exp= ect the php 8 implementation to be easy.=0A= (though straw polls have much lower response rates than RFCs)=0A= =0A= - Functions can be added to a namespace after they get added to the global = scope.=0A= - A lot of namespaced php code refers to functions ambiguously=0A= (`namespace Foo; echo strlen($x);` can either refer to `strlen()` or `Foo\s= trlen`).=0A= What were your plans for handling ambiguous calls?=0A= I was in favor of checking if either existed (current behavior) before au= toloading `Foo\strlen`, then before autoloading `strlen`, to keep performan= ce acceptable.=0A= Others preferred various alternate approaches to autoloading.=0A= I don't think there was ever a straw poll to measure how common other opi= nions were,=0A= or if people would accept a given approach despite having a preference fo= r something else.=0A= =0A= The alternatives I can imagine/remember from previous RFC discussions, *non= e of which I hold* (https://wiki.php.net/rfc/use_global_elements#deprecate_= the_fallback_to_the_root_namespace_instead and below had somewhat related d= iscussion as an attempt to reduce ambiguity):=0A= =0A= - The exact way to deal with ambiguity when autoloading, e.g. "autoload Foo= \strlen() every single time strlen() is called" (I object because that woul= d harm performance significantly)=0A= - You should make calling static methods easier (doesn't help with a lot of= internal functionality like strlen() or polyfills for PECL functions are g= lobal functions)=0A= =0A= Other thoughts:=0A= =0A= - Maybe it would be useful/practical to initially *just* support autoloadin= g functions when they're passed to function_exists($name, autoload: true) o= r autoload_function($name).=0A= I don't remember if that approach was suggested before.=0A= Then again, I'd personally want something more powerful than that due to = the inconvenience, and I imagine most people would.=0A= =0A= Thanks,=0A= - Tyson=