Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121785 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 83031 invoked from network); 23 Nov 2023 18:09:59 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Nov 2023 18:09:59 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 35F6E180031 for ; Thu, 23 Nov 2023 10:10:03 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (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 ; Thu, 23 Nov 2023 10:10:02 -0800 (PST) Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-db3fa47c2f7so1042169276.0 for ; Thu, 23 Nov 2023 10:09:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700762997; x=1701367797; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=eU6BF2a5SCQSQixM30ml6oEvtmOjUK6odcOMvvdvt7M=; b=HspQCMDFUYPIJUkwiL1gk+Eg2mNlehdlWx6W5+KKhxdUfDjszkGykhaCKg88sguGDq sLNSBW2TBbLwQKzN3KNSOgwBFEUVygOoq0vkCJfT5tAoMjvlbCM8fbVIUwUSD05Ky32d 3Xv1nPBhMB+nGYLgUvJgkPPTJ135PgQwWsSsugv1XFa5HYHWYUM2TQmtOXyuUFKNwIM5 ttYPZGswg+9UpOrqFQXXyzF+TJroNP9rHc7p53joQJfaNiXtb9PF6NXvQQZzNOHzjZQJ x98WivrnIhIL25hsplaSB1ZqwKjypP5HlfeLy4MgQnCo0tscFH4G27cWN2Z/j0uMf/ZC KqXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700762997; x=1701367797; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eU6BF2a5SCQSQixM30ml6oEvtmOjUK6odcOMvvdvt7M=; b=srfT9A1fiLygSZsR0nKAcbrudXzi3ESHaw526Z8QU+Dc1i2XXYw3pgv97+W6vkMMOn fkelnBNt6z5PMFotp2XnpBgUTAyoq+XHo+a0MYmbMc9IJUcmjsBkmmSkPqm0w1RVpVMd PPUrdWSRSJxYgs9zR0yppOzH6aOIGv9HmbF3/VdAFf9qrPADJDU8xxb+sYp2u3APU+7a UnqkjiuUUmzAzenQA0fyBC7beUXwEeKbTFd3CVrM540SvdONL3X8NJbVvfDVOj04gtGr 76D7hWo/ACjLTD3CDhhdKMtWn55nEPx3GS/9BEI46ufcAYGOGI4ope8VmOkXTjCl1acF 0cCA== X-Gm-Message-State: AOJu0Yzz2KOE2NnLglKJ0j7BocnU1lZHx9FhfPB42zwe5Inz/u7uSVdE FGUZywc+jOFXDfuG9C3jkVE5BwVed45uaIC/P+pk7CkL X-Google-Smtp-Source: AGHT+IH/Kd+/qqWa+nbHUdlBPRJLDioVyR/PYB0tMElW6yxRWoB1JX/p3iOfl7FYczf6/XuYaYb33VqQhPuBGIGGses= X-Received: by 2002:a25:4093:0:b0:db3:fcc0:dc95 with SMTP id n141-20020a254093000000b00db3fcc0dc95mr58398yba.2.1700762997294; Thu, 23 Nov 2023 10:09:57 -0800 (PST) MIME-Version: 1.0 References: <79d675e3-95b4-40bb-baf4-3e1c998f5390@online-presence.ca> <34979AED-893F-45DD-B641-A9F4F39B2928@newclarity.net> <2D505086-6AD9-4596-A515-85B50F5D12C5@koalephant.com> In-Reply-To: Date: Thu, 23 Nov 2023 18:09:44 +0000 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000004d0c4f060ad5be6c" Subject: Re: [PHP-DEV] RFC Proposal - static modifier for classes From: rowan.collins@gmail.com (Rowan Tommins) --0000000000004d0c4f060ad5be6c Content-Type: text/plain; charset="UTF-8" On Thu, 23 Nov 2023 at 14:20, Stephen Reay wrote: > > Out of the box, with no package manager or module loader or anything, you > can do as little as call `spl_autoload_register` with no arguments, and > have working class autoloading. > Sure, it's just about possible that you could paste that one line into each of your PHP files, and they'd all pick up the right classes. But it's more likely that you have some shared include called "startup.php", "boostrap.php", "header.php", etc, which has that line plus a bunch of other setup. So, the argument goes that adding a line "require 'namespace_foo_functions.php';" to that shared include isn't that big a problem. (If it happens you are using Composer, the files and config are listed in a JSON file rather than a PHP one, and Composer generates the shared include, but the logic's basically the same.) The strongest counter-argument, I think, is that it *scales* badly: once you have more than a handful of such include files, an autoloader solution becomes more attractive than listing all the files. However, in itself that's not an argument for static classes; it's an argument for function autoloading; the argument for static classes needs to be either: - "admit it, we're never going to get function autoloading"; - or "I'd want this even if we had function autoloading" (in which case the discussion of require vs autoloading becomes irrelevant). Regards, -- Rowan Tommins [IMSoP] --0000000000004d0c4f060ad5be6c--