Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123632 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 qa.php.net (Postfix) with ESMTPS id A7AB71A009C for ; Sun, 16 Jun 2024 12:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1718540171; bh=51brcU9Yq0Zg2ahkGFkUEsUh+WP2w6HuaHPAkOhVQlo=; h=Date:From:To:Subject:In-Reply-To:References:From; b=YtmkIxhFJJGxisYSgG5+tWXRq54wXBcwM1RjphCSnBlM8PHZw+ok1UCr5Jss9pnjn 3SVTSR747BechklsCu5Dh/ILjmACt0+CC7Ex1fQjSE8mgc1E2mHn/Qe2dD/4AFpm5I 4dVgzPFC0saD2mZ+eWz0U9GUSTbOtGtpUcblixOynARLuJ97q5aQ2KXZ4PYJqbk3tx eCmClE2Jy0bogD6GF+W0oKlOuWwOwkqiF2c+44+/40XbAk3oYYu1UWFB+zDdXQytZS 5u6c56in8AE8Q2jn3V5rp7Q0Mf9CssK08psD8nRr+/k7t3AUlJZm0L0H1ZSVQLNm2g z1jxVMKg6b5cw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 665DC180003 for ; Sun, 16 Jun 2024 12:16:10 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 fout2-smtp.messagingengine.com (fout2-smtp.messagingengine.com [103.168.172.145]) (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 ; Sun, 16 Jun 2024 12:16:09 +0000 (UTC) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.nyi.internal (Postfix) with ESMTP id F038313800B2 for ; Sun, 16 Jun 2024 08:14:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 16 Jun 2024 08:14:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1718540097; x=1718626497; bh=51brcU9Yq0Zg2ahkGFkUEsUh+WP2w6HuaHPAkOhVQlo=; b= c5JdJLa6cwlOSDnOuhCkEFgWCvUFshe2g1Ay5IIQqXR4goovoe9meBtco7FQfdqE 1sIX33TWx3Gk51UnaPQ3NHumeZQh5MSFt48tDBAWmi5LfIJgzzrt16FtKvcHPB/I 0gEZHSu6V2N0TMFa1UYY73F9cMBorXGFqaU5k6vy03cCcW9+/EKgXzT8gSAoL6H3 0DMOlUqccBDKunqHsR+EDI1wn2vwiHam4eRavqIjymTHOhpdpdzSCXYdjIcUHcgF 1tItH3rOhN/Fxr20BM2kADXK/FDKXx7yeAPCobpRFz/By+WfskU77sBSljBRqoIX UOCBlhWh3ZIrEnhKnwzj0Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1718540097; x= 1718626497; bh=51brcU9Yq0Zg2ahkGFkUEsUh+WP2w6HuaHPAkOhVQlo=; b=l r2UcIfhAgxPFZaHg0R0zDaQ/VkFPcKfzZSyz8mK42jw071onabkhJTEsHyjudbx4 BbxRw3/ld3RIhtmF4+NiBpaIpBxXGdgtK4tpEH7+VixMFvzj9CYFUwviVY4bXZcg SSzu/A7ZWT4zy8oiD2APCGST1tghTSKT2n1c1RTycFtI5jz4XYbnj2lMUWHWiyfx PlSh7hK2ZV3Iquo5KaRg1kTWWHBP+l5lgYxfww/uoS9jJD/pYNDV6DZeclO5gGFG W/GhUrE/HexOR1IHFCMuCiCtVv6EE9fBdLjsYail+aYF370Ol6s6hlt49DLz6xQe Wl3cH8lvufh6x7SaYylCA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedvfedghedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvufgfjghfkfggtgfgsehtqh hmtddtreejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhnshculgfkoffuohfrngdf uceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenucggtffrrghtthgvrhhnpe ehleffteeigfevudetfedugedtudevledugeeugeelheeihfehgfdtkeevvefgleenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehimhhsohhprd hphhhpsehrfigvtgdrtghordhukh X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sun, 16 Jun 2024 08:14:56 -0400 (EDT) Date: Sun, 16 Jun 2024 13:13:52 +0100 To: internals@lists.php.net Subject: Re: [PHP-DEV] Static class User-Agent: K-9 Mail for Android In-Reply-To: References: <0cf69a14-f1b5-4077-9d91-d7b579485eec@scriptfusion.com> <936e1aa3-48cc-4552-9f68-676ebcdeb596@rwec.co.uk> <1fc2f2d0-718f-45ec-8968-b66a1bde686e@scriptfusion.com> Message-ID: Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 15 June 2024 18:39:20 BST, Valentin Udaltsov wrote: >PHP does not have internal/private functions=2E >Very often I use functions for really simple things like `array_flatten` >(and register them via composer=2Ejson=2Eautoload=2Efiles)=2E But when th= e function >requires decomposition to smaller ones, I switch to a static class with o= ne >public and some private static methods=2E Namespace visibility or a native "internal" attribute is something that wo= uld be really useful, I think, because it would be able to apply to whole c= lasses as well as functions and constants=2E It would also allow you to mak= e the refactoring you mention without having to switch all calls from Foo\b= ar() to Foo::bar() In general, I think PHP should embrace the concept of "packages" much more= - for larger apps, there's a much greater scope for performance if OpCache= could analyse multiple files at once, and make assumptions about them=2E (= A consideration which didn't apply when autoloading was first introduced=2E= ) With that in mind, instead of function autoloading, maybe we should think = about an "include_all" function, which accepted a wildcard/glob pattern=2E = That would make it much easier to use preloading, and move away from the "o= ne class per file" layout, without blessing an official tool like Composer,= or a particular file layout=2E Put together, those features would provide a powerful alternative to a lot= of static classes - i=2Ee=2E those where no state or inheritance is requir= ed, just a grouping of code=2E Regards, Rowan Tommins [IMSoP]