Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124156 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 F00191A009C for ; Mon, 1 Jul 2024 18:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719857339; bh=FA4LKNIQjDjLJozfHZgeir51LPKhdeAPdweu0ZNS7DA=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=gNV0nXe8NKZT1PgWHTXeYH9srSzJ2PLvZJ4auQiOrjBWcIWJa/WuKY6dWxqMS2m0N 3jg9SsqUa3IB1tYR9D7GZE8d9hmNzGrh3poz5RYoC4xnc/v83AK9oUoJCwSrwW121Q 2QJqv/wnTZbn0bqfqNHnjnnSzIqVySUlDqbvhvSXwlsaeTl6yuGrol+IIvwdiGGik2 Ah3AsoOvwp9vlqnrt/98lidxQucn/7Un/SCmYBNEupu9p4NQuVIzE9eg0gWArEiilN a021BoEVsGntI5hfyzSV2G8dkNA1ZExGZA/Z1syximBLO/RmsAzKVCCiSQ/9hkAFbs bflMZEtuzIbBQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 68FCC1805D1 for ; Mon, 1 Jul 2024 18:08:58 +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.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, 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 mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) (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 ; Mon, 1 Jul 2024 18:08:57 +0000 (UTC) Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-64af39fbc57so28923147b3.0 for ; Mon, 01 Jul 2024 11:07:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20230601.gappssmtp.com; s=20230601; t=1719857256; x=1720462056; darn=lists.php.net; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FHSt86sS8ov1XmI55BbK7kTRoHGW7LWPnQjBhIj/ImY=; b=rj2IuSGuuZtkeZpvyXIMKl1CcmItv+ReJGf81qPT522/38RQuPrULqVWkrk3R0NJqM ZKaoHSh4+1fpoCqdVNrZRS4eptpRoW01mFRa2HnKy7sMK0Uazr1khnN5YfFkP1lTNyeo ttNYMJnqsquPTdYT0vdD2FGRtbELiyYUhtebVfLONU0iPsB6tWofvdCyyCJ1TmvURTMG l1eJoDuvVaJDd0VDQN1hO5gve7T8FhKvx3iZkXMJ43OIqxw6TMRnfars06E8UCgKLWSO Frrr3yiFJ73vpf7pyLCFj1ikuuUNuJ2Zst/B/jLTujg8m+yj6vviqgiSVDIySjCslyrP uY1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719857256; x=1720462056; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FHSt86sS8ov1XmI55BbK7kTRoHGW7LWPnQjBhIj/ImY=; b=bSjlHJnYZCfami1VxJUcSHO3jYviJTxFLAO2gPC3BO0BhauNIsGgnFUQK9+2HKIAoZ 9EaCDR+A6ezBUyg3Uwymo7RCXk3WoOhAi3cc/7u8laTNkbMpkJsunbl0MJjaqsUDXQ/8 qOQdDj7EpEz+JiweK0W95C4qjbImtwpGZaENgafPNRKiOC2MLRgMXIUADxEWuv0i7rMJ XGScet5R2oY635CHykxRGSbkcfLJAdACeN4vxg3stD33x5b9IwGDSyyFCLAJ1aC/KSY/ AtImDde/PgTzm+C41JGM++zeVfOhqH5RXQWZz1H0E8GQZcOWY5uS6dAE37LobawDfSwB Fahg== X-Gm-Message-State: AOJu0YxqYl9ePgXtgmBIM8shfqmTgrxhXO1nfzJch5vS8CWPzKwVTJ9K bQ5rj2ZXo2rYmjgcrPq66l4IUNyFvN3es6UPBzlAYWiZgC2GWZjzU2cCsPtpRVI= X-Google-Smtp-Source: AGHT+IG9o6cQV7qaF+nRSN7UdSD0t8WT3HC547XjzTWlku9okTtf2W6yjsaPemy6ojc75gm+vmcx6w== X-Received: by 2002:a0d:e607:0:b0:643:bbee:be26 with SMTP id 00721157ae682-64c7123ae4dmr68024847b3.5.1719857256494; Mon, 01 Jul 2024 11:07:36 -0700 (PDT) Received: from smtpclient.apple (c-98-252-216-111.hsd1.ga.comcast.net. [98.252.216.111]) by smtp.gmail.com with ESMTPSA id 00721157ae682-64a9a239c5dsm14656197b3.46.2024.07.01.11.07.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jul 2024 11:07:34 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.8\)) Subject: Re: [PHP-DEV] Iteration III: Packages (was Re: [PHP-DEV] [Initial Feedback] PHP User Modules - An Adaptation of ES6 from JavaScript) In-Reply-To: <4D45294E-78BA-466A-B2B4-F17BA4E1ED73@woofle.net> Date: Mon, 1 Jul 2024 14:07:34 -0400 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <7593EA45-DF41-43DE-9EAD-F3CCFC8A7D47@newclarity.net> References: <1917CF7C-26D8-4DBE-B05C-5AA650AC6C9F@rwec.co.uk> <551cd5b0-1c00-4818-a9ca-97f6b7e8c3dc@app.fastmail.com> <39B496F8-062E-4848-9B3B-529BE8D3415A@newclarity.net> <856F4F70-DC81-4098-82DD-5F6D47CDF3F0@newclarity.net> <09559430-4477-4516-8D78-6F4071E1AA6C@newclarity.net> <4D45294E-78BA-466A-B2B4-F17BA4E1ED73@woofle.net> To: Dusk , Arvids Godjuks X-Mailer: Apple Mail (2.3696.120.41.1.8) From: mike@newclarity.net (Mike Schinkel) > On Jul 1, 2024, at 1:07 PM, Dusk wrote: >=20 > On Jul 1, 2024, at 09:22, Mike Schinkel wrote: >> 2. Autoloading effectively necessitates that every symbol be in its = own separate file. >=20 > How so? While Composer "recommends" PSR4 autoloading with one class = per file, other configurations are entirely possible, I spoke inartfully, sorry.=20 The culture of projects throughout the PHP ecosystem has resulted in = most projects being one class per file, and there have not evolved any = defecto-standard tools for creating those classmaps further ensuring = PSR4 ubiquity. > either with Composer's autoload.classmap (which uses a precomputed = class -> filename table), or with a custom autoloader. And, refer back to reason #1 to hate autoloading in PHP. > On Jul 1, 2024, at 1:28 PM, Arvids Godjuks = wrote: >=20 > But that is why interoperability in PHP world is so high. When it was = introduced, it allowed enabling autoloading for most code bases out = there regardless of what their structure was and still is. Sure, you = have to be careful how you do it, but that is also not really a userland = concern - most of those have been implemented once and then almost never = touched :) The community has settled on a general approach since = naturally and that's how vast majority of people write their code. Buggy = code is buggy code, it really has not much to do with the autoloading = and with how people write buggy code :) You are blaming the hammer for = user trying to nail the screw into wood :)=20 Two things can be true at the same time. Something can have a = historical benefit but not be ideal moving forward when compared to = potential future alternatives. The major benefit that autoloading has today is inertia. Yes, that's a = huge benefit. But that does not make autoloading beneficial. > You can already sidestep autoloader by adding a require statement to = any file and loading everything without triggering autoload.=20 There is not a standard way to sidestep the autoloader that has majority = support in 3rd party packages. It's a roll-your-own thing. > It's far more powerful in userland because it allows people to do = whatever they want with it if they do not like the standard = autoloader(s).=20 The only reason people think about how they want autoloading to work is = because they have to. Technology is supposed to evolve to eliminate rote = and low-value add tasks. By the same token I could say we should introduce the ability in = userland for people to modify the implementations of standard library = functions so people could do whatever they want with it if they do not = like the standard implementations.=20 But clearly that latter would be crazy talk. > That's just how PSR-4 standard was written and works, and it's a good = default for a reason. On small projects - sure, I can see it being = overkill. But I haven't worked on a small project in a decade and I = rarely have that little code in one file that I would want to stuff all = together in one file. I do use PHPStorm, so it is very adapted to how = most PHP projects are and provides excellent navigation abilities that = fit the PSR-4 and that way of structuring projects. Vast part of the = community uses it. It's a standard in a lot of companies for a reason. Again, I will say this is Stockholm syndrome. > See my reply to autoloading things above - you can eliminate the = autoloader triggering easily in probably 15-30 minutes flat.=20 But to do so there is not one single way that is reality standard. So I = have to own maintenance of that low-value code. > There are aspects to this that go beyond just technical aspects. = Wherever when implementing autoloading people were secret geniuses, = stumbled into it accidentally or just had practical needs themselves = that they just implemented in this way - it has been a major turning = point in PHP's life and has transformed the ecosystem into what it is = today together with the rise of the composer package manager. I have = seen people talk about visibility in namespaces, package concept and all = that, but every time it was building upon existing autoloading mechanics = - some adding capabilities to them, modifying them, having new type of = autoloader. But I have never encountered anyone in this community in 20 = years i have been an active part of it to propose a radical change like = this=20 That is probably because you all have been working mostly in PHP and not = experiencing better alternatives. BTW, NodeJS/Javascript is NOT a better = alternative, IMO. Besides, what I proposed earlier was not a "radical change." = Characterizing something as "radical" is just a rhetorical tactic used = to discredit said thing. What I proposed was very incremental and would = allow all existing code including autoloaders to co-exist with a = module/package concept. Not radical. > and I'm fairly certain after keeping up with the thread that it is = almost universally not what people want. Most people just want the = toolbox be "finished" so to speak, not get a completely new one in = addition that has no compatibility with the old one. I get it. I am no longer proposing an alternative to the autoloader. PHP = developers are comfortable with autoloading and that is that. But that does not mean that I cannot tell you and others the emperor has = no clothes in hopes that people eventually see that there can be better = alternatives. -Mike=