Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108285 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 38936 invoked from network); 28 Jan 2020 11:40:49 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Jan 2020 11:40:49 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F28071804F6 for ; Tue, 28 Jan 2020 01:51:08 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS 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-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 28 Jan 2020 01:51:08 -0800 (PST) Received: by mail-ot1-f50.google.com with SMTP id 59so11376469otp.12 for ; Tue, 28 Jan 2020 01:51:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=c6B9Yd1BqsZGSkSlfCR44gGvWSByoqJ/QdE8hGSSd0U=; b=U1nDNtIB8pbYKp9Wx6ZGa6rG1fFBE3MtUWt5vD78qEN2foYQU28XYocYGa29NpiiUX zIw6l5rCtVIn5CN5n8BkAw0lBaSa/fBYRUYKoD1MYXJ/bQJlXgJQ/tzvMc6pW0P5wKQD AID/hNcLu2dxN8keHbM+Vsw3uST7JR0nsrK1kkxXzEfEIQa4sWfQN3Hin1ZWCsLLulHW nAeWXBYQVKGEISXcqB1kwl/JujMv2/3sqYK4oWnfj0fSw57etU77TTLt/0uHqCDw++LR mPl3eb8RouIvAz1vXVn/TsGgoO3SV/GI7lYJgKq9BHL3dQdT+XYtc7CgaBZdahmBFCJ+ +Blw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=c6B9Yd1BqsZGSkSlfCR44gGvWSByoqJ/QdE8hGSSd0U=; b=UcGIYHS2idOZoyezFrULEdHzWKayTRwaapbnY7aYEio2mi4DYgO7ZGwDJ8C9Yg5euu 0VMC0OVHE79YaFLwnu1XKcabCOnfnja5/frDE91034iqcDMnYYcAJZ9MAwACF2Xm23UN 5xbWHWH6eHUPI6zroTJdtL0aG+vxvWKieV/fR3gK4tYWuE3Yt4mdgOEOLhimOQB6K2O5 +tmYlNtMrijA9QajXSgFKfsxkjbrS+v9jPVNtOrhcxtp3JaXw82c6iFtMzHlGH7pqGMb YJZrprAWzkNOuGK78np9a5Ra+xw2mIOhCeLGdxkosjj+Cg0mET+AQo9DdneIoVySziwD jVUQ== X-Gm-Message-State: APjAAAUXnX4CEZvNU8ZcSXuqbMlAl4UBWOVWcxn+OkR7rOE3a2jYjZte JM/khzcHD876P8X5J6rU4x8JKfSQ+z4oR2dfXck= X-Google-Smtp-Source: APXvYqxSWggOznaUXXfwIFC9L0BC6bdb471zG6AiCcLMzfnBcwK1RMHxkrzx91WvjMLwlt/K2z2u36wXaCKHxoGcT+4= X-Received: by 2002:a05:6830:1d4c:: with SMTP id p12mr16231343oth.198.1580205067595; Tue, 28 Jan 2020 01:51:07 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 28 Jan 2020 10:50:56 +0100 Message-ID: To: tyson andre Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary="000000000000b9f411059d302981" Subject: Re: [PHP-DEV] Re: [RFC] "use global functions/consts" statement From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000b9f411059d302981 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Le lun. 27 janv. 2020 =C3=A0 16:10, tyson andre = a =C3=A9crit : > > can we please discuss this alternative? In another reply, you link to > https://wiki.php.net/rfc/use_global_elements#deprecate_the_fallback_to_th= e_root_namespace_instead > > > > But this new proposal derived from Nikita's idea is different as it > doesn't need to deprecate anything. > > I've added > https://wiki.php.net/rfc/use_global_elements#add_setting_to_make_all_name= _lookups_global_instead_eg_declare_global_lookup_1 > to the discussion notes for the RFC. > Thanks. It's a bit strange to read the objections to the proposal in the RFC. That makes it feel like "we" agreed on them - while it's "only" the author's opinion. From this part in the RFC: > and changing that default would require changing a lot of third party code. not unless it's opt-in, which it is. > A separate option such as `declare(lookup_classes=3Dglobal)` would allow migrating to that, better have lesser declare() directives IMHO. > but would confuse developers switching between codebases using different settings of lookup_classes, > and introduce similar confusion about the rare case of multiple classes in one file. Not sure how this would be different than any other declare directive - either the currently proposed one or even strict_mode. https://wiki.php.net/rfc/use_global_elements is opt-in, and also doesn't > need to deprecate anything. The link you mention > is a different proposal that has deprecations for constants and functions= . > > > I'm not comfortable with having a 3-ways declare directive. Who will > pick which of the 3 and for what reason? > > That's going to be a mess to review. If we're looking for a forward > path, there should be only one opt-in way: a boolean flag. > > I'm not sure what you mean by 3 ways. It's at most two, and a setting for > global name lookup might become mutually exclusive (forbid using both > setting names) > I meant 'default', 'fallback', 'global', and declare()-omitted. Rowan's latest message is a better ground to discuss this so let's continue there - I share his concerns. BTW, should we use the word "root" instead of "global"? "global" might have a bad connotation, and "root" is the word used in the description of the current behavior of PHP: declare(function_and_const_lookup=3D'root') > You mention this should be another RFC. But process-wise, I think it > would be better to vote only once on a specific topic, vs having several > iterations that undo previous RFCs before having a stable consensus. > > The issue with that is that there's no good way to set up a vote or poll > for that in the RFC structure. > For sure, I'm not suggesting to add a sub-vote. I think we should be able to discuss the best proposal we can imagine all together and put it under a yes/no vote. Reusing the "root" word, I think we might want to upgrade the current proposal to: declare(root_lookup=3D1) I'd see global_lookup=3D1 and function_and_const_lookup=3D'global' as being > significantly different in who would vote on them. > The former requires a lot more refactoring and code changes to handle > changes to class name resolution, > compared to the code changes of just changing function and constant > resolution. > No proposal requires any refactoring if things are opt-in: existing codebases will continue to work as-is. New ones might start with the new declare directive. Existing codebases could also adopt the directive once the tooling is ready. Eg. php-cs-fixer has all the required infrastructure to automate this transition *for authors that want to do it*. > And because changing resolution of class names has those drawbacks, I > don't plan to change direction within this RFC. > I don't see these as drawbacks, especially when the target is cleaning up the rules of the engine for a better future :) Can you please consider it? While this reply might feel like I'm "just" criticizing your work, it's not: I'm very thankful for what you're doing here and I think you are doing a great job. I'm "just" trying to help shape the best proposal for the best future of PHP, although very modestly :) Doesn't anyone else share my points? Nicolas --000000000000b9f411059d302981--