Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106580 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 44433 invoked from network); 14 Aug 2019 11:07:53 -0000 Received: from unknown (HELO mail-wm1-f51.google.com) (209.85.128.51) by pb1.pair.com with SMTP; 14 Aug 2019 11:07:53 -0000 Received: by mail-wm1-f51.google.com with SMTP id z23so3692707wmf.2 for ; Wed, 14 Aug 2019 01:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=H2EW2tje4Yfn14GPKA46UykNmARNeUs8k5hqcvSYjq0=; b=lzcUSZadnFNokJoY9iyyXYZTdnbO9w7K9tS0furfKnUFR7kE+SSu6qgxmGcP2NgxIe HEZDbWXZR/1oDzgWl2VDIYWPOIq69R/NjLhfInWGACbxeWHzCL2B0Nhfr5ucYNj4vgW/ /MHsdNkV46d11XUd4qSp6nALHivLH/yZh1f2rJQc+we8dWB//6gbdaqZEgQI6OR5uaJD cptWooiTXTdMonOJNIzLpiG0EKt1he7aeNcTE/HsKQxCF6i1xzh5+3IbWPpgtf1Iqunt FDSK7WiGhGon88XYsZ7p0Wp8Sf401XBEAHyObSATLAk4qHtp+6LBgx5436HTizZc7t5N d+Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=H2EW2tje4Yfn14GPKA46UykNmARNeUs8k5hqcvSYjq0=; b=e9LZ6lL5VJVixZpNSOFGRT2w/VeHp9N6rqvOQkagXJXYp2NRul0DbzhiFXxTGbMQ0y ef9JchyDn8pLvXluF3Sm9+62gzHwPF3OHxKq+1lPC3d+LxKok2VJTwpHJRViBwx5vBX0 o4tukV52TqVJLc/2WAUQ/5OAP7MKh+pFvgVHIkIUhb75n2n8SLuGxsjkc11Hf1Tje4cl WqWWIbraYScpUWXKKfFsvMkIgEwrAq5W6hsELzlqvXePUO9Smd0lj/1cB+qsIGMlMJFv n7VHa2oEXsRfOnMfLmmQZM9Nkr4d2fPl5L+9gfZQtzYbkdJF0OSt3KeezlY4jpJZU3aa 8Dzw== X-Gm-Message-State: APjAAAW71XrTJqiPI1zUsKVxwiTuRkL4bb3/3/Txyx0E6Tq0oEd959Du WnuuHJCDTEGXZcpp4Ximjx/QxWuV X-Google-Smtp-Source: APXvYqy0wUZqzOCra8HC1xyhVHdPTqAw5Z3zjKaB7uP+N2fGgKQeDQg/aAfOot6H/0YyOsmWUEPYOA== X-Received: by 2002:a1c:a615:: with SMTP id p21mr7075297wme.121.1565771788888; Wed, 14 Aug 2019 01:36:28 -0700 (PDT) Received: from [192.168.0.16] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id m23sm4874202wml.41.2019.08.14.01.36.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Aug 2019 01:36:28 -0700 (PDT) To: internals@lists.php.net References: <25d774e8-183b-d39c-4ac4-81c1b7770229@gmail.com> <5d5298a5.1c69fb81.b4ed1.2d97SMTPIN_ADDED_MISSING@mx.google.com> <3db68c5e-54d1-812f-bbf5-1b089cba1bff@gmail.com> <5d52f72d.1c69fb81.8f95f.57a1SMTPIN_ADDED_MISSING@mx.google.com> <2bcb05d6-abf6-4fcb-599e-eaf4bcd58878@gmail.com> <5d533983.1c69fb81.641d8.0111SMTPIN_ADDED_MISSING@mx.google.com> Message-ID: Date: Wed, 14 Aug 2019 09:36:26 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <5d533983.1c69fb81.641d8.0111SMTPIN_ADDED_MISSING@mx.google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Re: [PHP-DEV] [RFC] Namespace-scoped declares, again From: rowan.collins@gmail.com (Rowan Collins) On 13/08/2019 23:28, Mark Randall wrote: > On 13/08/2019 21:26, Rowan Collins wrote: >> Ah, that makes sense. Does that necessarily mean we need a dummy >> class, though? The autoloading logic in the engine knows that it >> called the autoload callback expecting a package definition, so can >> count as success that the package is now defined. >> >> In other words, the file the autoloader included would look like this >> (again, sticking to the notion that "package" is separate from >> "namespace"): > > Personally with file-level opt ins I'm not 100% sold on the benefits > of packages over namespace level information. I guess I'm not certain > on what problem they're trying to solve that's different from just > another object at namespace level. The problem they're trying to solve is that at the moment, there is no namespace-level information. Namespaces form an arbitrarily deep hierarchy, and don't need to be declared before they're used; it's hard to retrofit configuration into that. In my mind a package would be very similar to a namespace, but would have a mandatory declaration somewhere, giving a place to define its settings and properties; and there would be no "sub-packages", so no need to define inheritance and over-rides. > As for the dummy class, the only real benefit is that existing > autoloading procedures can be used to locate it and be included with > minimal overhead. > > PHP can call the autoloader internally but it would require userland > loaders to be upgraded with it, not exactly a huge stretch, especially > with most things being composer-based, but a dummy class would make it > work out the box, including optimization steps like dumping the class > list. I see what you mean; but the change needed to autoloaders would be pretty minimal: if they just turn the name into a file path and run file_exists(), no change at all; if they tokenize files in advance to build a class map, they would need to add "packagedef" to the list of tokens to search for, alongside "class", "interface", and "trait". The same change would be needed if we introduced a "struct" or "enum" keyword, and I don't think anyone would expect to write dummy classes alongside those. Regards, -- Rowan Collins [IMSoP]