Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107962 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 83931 invoked from network); 2 Jan 2020 20:10:49 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Jan 2020 20:10:49 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9E6951804F8 for ; Thu, 2 Jan 2020 10:14:46 -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=-0.5 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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 NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10olkn2036.outbound.protection.outlook.com [40.92.42.36]) (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 ; Thu, 2 Jan 2020 10:14:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jXks1hWKsyNYk1HTvmuL0WRf7A+xaw2oB+jjj8v2Ra1jTrEI5QzaV6aawcTsq+JWZVHP0gyyP33un8o6x58mdqmR7fYFpmJa/PUYHKGbLUs8bPe092ugvrbCfPQeIYVtAqXIcdCoYa12FVPGQQdxwIeOkmkcGK2Y6FRTb0ZKflrbjHiZPyljbYSiO4MvxIW5mV6w+/I52GiQSLaC6+25H1i2Zwz9lu5omdxVd6qZiFLgMuXWtb6iQyM97uHgVhJA0JNTQObj91azJLcUV4rsnC8rCR/TIFbOzrZ4rUbjQph8K69+HQQhjs0VOm2vMhI8TfnY0JegtHh8EEkYPZ5uuA== 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=RL0BR5rPh0LAGloQR/3WZAwSOYAakGGMmAiC5EVGLNw=; b=AcMbtp45q4hB6xHbSMu6kdktzgmrpK/kEsMBP+BtX7hFNEitQDRTZ8AJBeoKDdGDQZjiy48p3FygzAlzVQbzkrYAi8qkCgcdJo+JrbUx/KrNCj9FsycGntVJmzB/TIRmAh19UhNfYYv8yCI5Lrwt+2iE9QXE+HOcbOGxqY37buvoS7kWs6dOkhhUNP9/hLJMz7frmfIrw+8/9yF6l9VRRwH1mHLOKALgKPgLzkamBt1qabtzwLknP7UBEsg12M72WxqrOCpzAFeDvWf3tP5h3yZsrkr8NEnTVkmPRnxOoh2FeVdxmAMJipzZXwoYI+XXJiro8AmDRLWTzQFEGuya/A== 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=RL0BR5rPh0LAGloQR/3WZAwSOYAakGGMmAiC5EVGLNw=; b=s8HTI7gFE+5X5eHHserQ5O09NhIA+YgezaVqNc/i9Vmp9c5EQfuLF5QVVPdVhw+gNzNuj0zhbLfHWkOFQzbAR+ZfdT+xMVVD+OziydIZaJRNAT5HI0OUgLfGOZRed/uU4fCz/7SitI/qVDVTNQQonKXxAIln4u8gxucUBO/r1m2X9f1IwbyDU3rHdSfW+fuYc+ZFqH+2ZikCJOuA7MapykL12KJH/6r9PFt40DYBhUNG2QtoeTA7HgtGE164I4aDuRsfQ/6b4H6qVIlLFDhf1amSdZt+p/pPSOxwvdJSQssmpGJzWsIN7bVyxFPjeuThFKQAXtAKwBBClRAIsoEAIA== Received: from MW2NAM10FT044.eop-nam10.prod.protection.outlook.com (10.13.154.55) by MW2NAM10HT160.eop-nam10.prod.protection.outlook.com (10.13.154.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Thu, 2 Jan 2020 18:14:43 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com (10.13.154.56) by MW2NAM10FT044.mail.protection.outlook.com (10.13.154.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Thu, 2 Jan 2020 18:14:43 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com ([fe80::29e3:53bf:163e:5beb]) by DM5PR07MB3067.namprd07.prod.outlook.com ([fe80::29e3:53bf:163e:5beb%3]) with mapi id 15.20.2602.012; Thu, 2 Jan 2020 18:14:43 +0000 To: Mike Schinkel , PHP internals CC: Mark Randall Thread-Topic: [PHP-DEV] Re: [RFC] "use global functions/consts" statement Thread-Index: AQHVwNgGtev425C1jEaW2/fYCDQJoKfXmIQwgAAQD4E= Date: Thu, 2 Jan 2020 18:14:43 +0000 Message-ID: References: <5e0d723f.1c69fb81.e2ae8.24e2SMTPIN_ADDED_MISSING@mx.google.com>,<42078B8B-D8A7-4C6A-8A6F-17C6F69498E0@newclarity.net> In-Reply-To: <42078B8B-D8A7-4C6A-8A6F-17C6F69498E0@newclarity.net> Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:CE426C83AD6A7D9F2A948EB154B2B9991004B7CACAC2798A51AF34B6AA72C927;UpperCasedChecksum:4CAD6E00DC787E97FFF5CEEB42F48E0F3CE5988BECFBBCDFCC8D86BFFCD3ADBC;SizeAsReceived:7335;Count:46 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [Sj2/X617AAeoGvNePfE0xoDLdpW9zZKlwGFNBEclG8f4tb9uKecWIseqLYAX1I5k] x-ms-publictraffictype: Email x-incomingheadercount: 46 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: c3d39992-177a-4ab4-96b3-08d78fafa490 x-ms-traffictypediagnostic: MW2NAM10HT160: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: QM2Ytghr/RCKspLbCyKKQREi9fb0luYqRwabCRKfRod64LpR6hJDSrTyn2pAXV1QMzhFc0hWGTagN0tdIFwKrjXrk3xGCvRDHrs2VG4CU6ehq5WXJppgPMGnixnfe2GKeGGVWWzZn3xbm54wY6DKr3x67bsE+HlQSWvXSTna4daNCCO+EdCQE81GotvuDyMYKespU/FZEwJ5f98g66B2xDSlIyUSt1PKv9Hxbl54VjE= 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: c3d39992-177a-4ab4-96b3-08d78fafa490 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jan 2020 18:14:43.7903 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2NAM10HT160 Subject: Re: [PHP-DEV] Re: [RFC] "use global functions/consts" statement From: tysonandre775@hotmail.com (tyson andre) >=A0We might eventually benefit from versioned "libraries" of functions tha= t can be imported in one command=0A= > which would solve many-a-future-problem by itself.=0A= =0A= I'd be in favor of a module system, I just can't think of a good way to mig= rate to that with existing limitations.=0A= I'd imagine there would be various obstacles/objections to getting an RFC f= or that approach accepted.=0A= =0A= Of course, whatever you're thinking of for "libraries" might=0A= be completely different than what I think you mean.=0A= Proposals for that could start a different thread.=0A= =0A= For example, if one wanted a module system like NodeJS with "import functio= ns, consts from 'some_native_module_or_php_file'"/"export function ..."=0A= =0A= 1. Languages such as NodeJS, Python, etc. still have a core set of function= s that get loaded even if there are no imports.=0A= Those functions can get added to dynamically (see note on polyfills.=0A= https://stackoverflow.com/questions/27930038/how-to-define-global-funct= ion-in-python is hopefully rare)=0A= That would be an argument in favor of preferring deprecating checking i= n the current namespace,=0A= not deprecating the global namespace. (for uses that aren't fully quali= fied)=0A= 2. It's possible for almost any php module's functionality such as "mbstrin= g" to be provided by a native module,=0A= or from a pure php polyfill such as symfony/mbstring-polyfill. https://w= ww.php.net/mbstring=0A= Or even just a few functions from an extension.=0A= I don't know how the equivalent of "import [functions, consts] from 'mbs= tring'" would work in a portable way,=0A= e.g. with a future version of the composer autoloader.=0A= 3. This would add more ambiguity if imported names can get overridden (e.g.= by MyNs\strlen),=0A= making opcache less beneficial to performance.=0A= It would also make it harder to comprehend code if exported functions fr= om modules can have aliased names.=0A= =0A= A more limited version of "libraries" might be possible (pure php only with= other limitations) but it doesn't seem as useful.=