Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107976 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48476 invoked from network); 3 Jan 2020 17:17:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jan 2020 17:17:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8404C1804A8 for ; Fri, 3 Jan 2020 07:21:17 -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-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10olkn2049.outbound.protection.outlook.com [40.92.40.49]) (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 ; Fri, 3 Jan 2020 07:21:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Eey+GKrzwm0don7ktvdObbyx+nrkwXTxbmTYgC5Ihnt0Oue4t3VxJj9AaGrJkbkqECUtA0Rf5RwZlagk8EXZH9ak+Xc6tYOp3gLEiM0pCcFCb09I3kddex/qHgMIP0urhF9PyRS/qrEv9DjaVK9p5s8MAI2D8PLYKGS+rxi6j8L/krNV/WCIvnmCQleWUZH0ZyZBIT4GWyz5qGgurwLRXHQTVpai+Ymbc4+C2InCcsMBPgR7aicyXQiA22itiMeudl9Z2EgXahDe1DbYbSzwy+n8d6sZtY2t4vPasGZ9IBzVwA+c10PB2PQpRuxCcj///IjCRE+EJnI4/hXFzYDZcw== 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=YqcrczznbjaEZBMsc8ZFyqrT7cv/pIMM7/dSAVjslCk=; b=nj7aKsB8zJAauA5c/WKUB/sIJkvpa8fW0n+gnQoHXkUlRvjBJnmjpXVOWk2EQoV5ve3CWe6Sw7Gh2oDhQ7wA/tWz2Tm8ltploZ2T1viiajGZYsu7jMJY6aMLdwwbR07ernnh2LUyBMUdigQv9OMduKpboOEVAGX1dKz9fPjCou634YsUi1XB94TIz1+VRnbZTok2TOCoRnm0CinJBSn3i73uwza669OnIyC82qWTAihbr+pljZr1WVVOQFORFbpoj1QPzcPYGgvEyDGntqYoEnyfsmDo4p4wL7khuJ9VpnTQu4hPd62DOwo3TfAyST/KsgrhCxiFhvP1A0TckP5RmA== 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=YqcrczznbjaEZBMsc8ZFyqrT7cv/pIMM7/dSAVjslCk=; b=qyoVS7QO559T66KU1ALS57qUiaIk+kmc82RNjyjS9u9Zz/Ijk/RpLKncuyBT9G0DLeEF0uYkR6iigrJkh8ve7GhN+BfW+5LBnBsork7pFr2apXx0yh9mBKRgFMDsFhHoPWvjFBA0CK3G5I7K3MMNTR1jFBKAGWgvlHI048askDjVNyM5F5aiJHNpeZsEbnWHAvAAQSS4kiQuPWLe7KE6vPADUQ0OSMmJJjEWJZ159CUym7suQkAO43oTD3L5Z/BTXahx0LITDbwvyAqJnTuws5lnhC/rSHkASkC97UdrlnXGq3tdhAdXC4FDtI7HbE12LtVOEnOXI8fhFfD5ghDVVw== Received: from BN7NAM10FT021.eop-nam10.prod.protection.outlook.com (10.13.156.57) by BN7NAM10HT088.eop-nam10.prod.protection.outlook.com (10.13.157.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Fri, 3 Jan 2020 15:21:15 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com (10.13.156.54) by BN7NAM10FT021.mail.protection.outlook.com (10.13.157.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Fri, 3 Jan 2020 15:21:15 +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; Fri, 3 Jan 2020 15:21:15 +0000 To: Rowan Tommins , "internals@lists.php.net" Thread-Topic: [PHP-DEV] Autoloading functions/consts without a performance impact Thread-Index: AQHVwdV5EmiXz0tOK0a5kq9yFNlY0qfY/a8AgAABdgSAAAldAIAAA1RM Date: Fri, 3 Jan 2020 15:21:15 +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:054B41351135AF6E41997DE92E709744428EF2BB89F414426AAEB889F4048E52;UpperCasedChecksum:6D80E7034F892B8159D25DC1ABC6CC5551412BB580CCEE1058F3FAD60C263EDA;SizeAsReceived:7438;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [z220ekAx65dOfG9PTt0rZWQQKHoD2jevLihfw93cCZyzYD1lzUo7sAnXKhX79QS1] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: a98b55f9-ceb3-4f4b-0575-08d790609346 x-ms-traffictypediagnostic: BN7NAM10HT088: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: S7Q8g0highSJ56bLmUG4MNBUC4Wbb9X3oTrT4pYQLzEHoQccnmYnIYmcJ+JpvSXNt6KIAuBDXGYloWadfyDmNgEqbAmchS6/Mya5HO5t7uLYMXBRuiG2NMzbDVgTe+c5VqOGC9GlRmPD4lb/VZ77E9hWufDdLtuF+luAfItKJm+jIzXiXDTVLRW52u8G1k55 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: a98b55f9-ceb3-4f4b-0575-08d790609346 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jan 2020 15:21:15.7359 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7NAM10HT088 Subject: Re: [PHP-DEV] Autoloading functions/consts without a performance impact From: tysonandre775@hotmail.com (tyson andre) > Now the behaviour of my program can completely change depending on which = of=0A= > those functions I call first, which might even depend on user input.=0A= > Regardless of exactly how the cache works, that kind of unpredictability = is=0A= > a recipe for disaster.=0A= =0A= It already does completely change depending on user input, without autoload= ing, in the same way.=0A= I assume you're arguing against autoloading without autoloading \NS\strlen = every time,=0A= but I still consider the approach I'm proposing an improvement over existin= g unpredictable behavior.=0A= =0A= > The only way to make it predictable again is to pre-define the namespaced= =0A= > function in my startup code, at which point I don't need function=0A= > autoloading.=0A= =0A= Other use cases would benefit from function autoloading, though.=0A= The use case in your example is very different from the common use case I= =0A= have in mind for proposing autoloading - name reuse should be uncommon in p= ractice.=0A= Adding "use NS\strlen", "namespace\strlen", etc. are alternatives to make i= t predictable=0A= I'd consider reusing the name from the global namespace intentionally to be= a code smell.=0A= Overlap might be unavoidable for common names such as \NS\run() in some lib= raries,=0A= but hopefully they'd preload the entire file of functions for those,=0A= or be in a different namespace from the code using those libraries,=0A= and other libraries (e.g. polyfills in global namespace) could still use au= toloading.=