Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119951 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 99017 invoked from network); 12 Apr 2023 10:36:51 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Apr 2023 10:36:51 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0E1351804D7 for ; Wed, 12 Apr 2023 03:36:51 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,FREEMAIL_REPLY, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 12 Apr 2023 03:36:50 -0700 (PDT) Received: by mail-wm1-f52.google.com with SMTP id m8so19931986wmq.5 for ; Wed, 12 Apr 2023 03:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681295809; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=Uc5kVdpGy91wnI0nxljaYqmmu52kFQd/zGc2U+MvHWE=; b=KBqBNj0fFqznyajxiD+4Jv6RNOpRSqQNcbevHR9t9tqOXjJ1li+BKnJbg8EnRiAOla Epph83m2LNXBj9Et+RkcNxuXxFCZvdCmjP3l6QWhe7/9MJMwRkDWhmEsSyznBphTs/T3 Q+p362lXVDbB9FAp9kC7hkiGJDdeIhEnTg/YK7GrXBloCADYVvONVAU/XbHrGjDe44av pNlg2Kj4pqlhGg6n59g5qAuHo5Ttm2e2mstzitlYeNiA0LapeDI93ReOrbSV95WSMGW4 AnOTjRlPLZX0qwJL00jbyChPA0DcoFdNUBGxQMWmbxD0vEjrEZqsQB3REQOOP33eL3Dq lWlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681295809; 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=Uc5kVdpGy91wnI0nxljaYqmmu52kFQd/zGc2U+MvHWE=; b=Xan9npnxC5k1FcdDNVcDbJ4IWUoAWfkxwGU/b3/Dkiky3tU6xfOTLnXc+Mpncoz4mB 2qEV2Qm/78JqCKrjw6BSidvD36E774snowQFfsDMCHwoSd2QWA2/SN3l8BdTksQrUk+u pnKgiqnanYjimdNEMR0f2ki0QyfvUxkZG7CJQnV85XQ1QNMhhNVhTtptENC6Vl1hfY0f rJy9w23EKI+uBXqZT9eVOYOxeT+szZDz2ZaSX06+O6YxqV4VcQAr8BxU2tNN747CwU2C SwaMv3UlMdM5MljzlRl8ZuE0Gxnx9K1ZXe3QojVgNgf53I/+K4T86PJMZrkr35RIOJsI K+ew== X-Gm-Message-State: AAQBX9eVgKCTtJ7/cU6RtsGffgCf77UGtE9MUOXBvVQ5xZff90KVrS7i 1/GxVhMqRGQFgWwdbh5F8IDhrhwIeeTVt3f2IvdS31T/ X-Google-Smtp-Source: AKy350a/KExohP+N3LJalo/wyWeKlhgYxJ7fB9ZsHUnoi98hFwjypdlIBbXJSvQuxPrQvXaPYDucNyUHMGL5sjITC0s= X-Received: by 2002:a7b:cbcb:0:b0:3ef:7936:ecb9 with SMTP id n11-20020a7bcbcb000000b003ef7936ecb9mr1533811wmi.2.1681295809284; Wed, 12 Apr 2023 03:36:49 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 12 Apr 2023 11:36:37 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000798d5905f9212ff7" Subject: Re: [PHP-DEV] [RFC] New core autoloading mechanism with support for function autoloading From: rowan.collins@gmail.com (Rowan Tommins) --000000000000798d5905f9212ff7 Content-Type: text/plain; charset="UTF-8" On Wed, 12 Apr 2023 at 09:24, Nicolas Grekas wrote: > > To me, class autoloading is a performance feature. If we didn't care about > performance, we would be fine with eagerly loading a bunch of classes as > e.g. Java does. I think (class) autoloading actually serves two purposes: as you say, it allows lazy-loading, which was an important performance consideration before opcache; but it also allows mapping of class name to file name. Java still has to find the source file for each class mentioned, it just has a more rigid set of rules for where it will look. One of the big differences you'll see between PHP 4 and PHP 5 codebases is the number of source files - when people had to manually list each file to include, they tended to bundle things into larger categories; with autoloading, they used one file per class. There's probably more willingness to create new classes in such an arrangement, since they're easier to find. I think function autoloading would provide a similar shift in thinking: rather than one big "functions.php", projects will put smaller batches of functions together in tighter namespaces. That in turn will make it feel more natural to create a new file of functions, rather than using a class full of static methods just to create that grouping. It doesn't enable anything that a script generating a list of include statements couldn't, but PHP users aren't used to needing a "build" command just to discover a new file, so function autoloading feels more natural. Regards, -- Rowan Tommins [IMSoP] --000000000000798d5905f9212ff7--