Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108262 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 79801 invoked from network); 27 Jan 2020 11:31:36 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Jan 2020 11:31:36 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 81090180533 for ; Mon, 27 Jan 2020 01:41:43 -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=-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 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-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (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 ; Mon, 27 Jan 2020 01:41:42 -0800 (PST) Received: by mail-oi1-f171.google.com with SMTP id d62so6013292oia.11 for ; Mon, 27 Jan 2020 01:41:42 -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=qO4mx0lR/ziBTaeWjd41h1gUNiH30iKRe4kuNssrbtM=; b=fFIc2VPZdTw177yNKGF0wRgclrFlmfLZbi/HQ3MV5ipfqKncGp0iXtqEE2YI7dd/aJ GGPMzTdCxV7qAS+xWvzYZVNbdgbJwty3T8pzDgqX6vM6vZ8uombdJEiOeSi7eLiralge xQqF+xnOBRtFe5RVxUBL41YkOF6eCk2QUVKWE2vEoRIdg4G/VLdNYOdSZDf1TUAPMiJ7 dz+FnAaHTFER62LQyieHa782z6xSyCxlxxd9AAhfQvj7qdpr1s4wh2YLhco/mIs0eSzV nE7/amgfFvulyy8Mu3gcHdak9n4WEeCVNvNNNJg5g7WiOj4qZjyJWyMjLYPJme0SR35z Tu3w== 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=qO4mx0lR/ziBTaeWjd41h1gUNiH30iKRe4kuNssrbtM=; b=LGbRY37auvdFqvpHDL6rMi7vfIF2VYOrTmFLx6nh0UG0kG9E+lagpSfGeIGP9DugG6 3NyGyBd2uSWEwfng3T8WyXu6fdZTRlNtgtCCdPk+ngeS3BW2CDbrip8kyuBPudh9ANof 2OS2funmMd035nom0ttpDWyNbHv7zUGCKG6sjMQmsDavhwAHWcCtM7DkCYiq80RSVNbg Dvfk4tIprpKBHYS6hq/3VdI3zKR/R7xMuLL5SYUj85qsn+PjcVpSe7TlYnRucmZtPcDr pPQWSDCW0bPy42OnDRc9t6cc/3/JOn7kzOefWMGY7Xg6LfX8RDcUdQ8ydHLv5oKc/VRM ZzEA== X-Gm-Message-State: APjAAAXrtpkJKTqn7/IaKMLmXiFmkdJ901s1pcFxi+AuXSMz2h67dLQj ogtr5/lr9aJcej5NoUOQhXqT0CrR6J2E4/k6XMU= X-Google-Smtp-Source: APXvYqysg4tx/hV1c0mQtst2YuA5f5CZ+RK3UfrABztOWAzxRVKh3THeD0uoWleAn3S1jA5/eEqniTDwuj6kI37wj/Q= X-Received: by 2002:aca:4e02:: with SMTP id c2mr5376456oib.142.1580118100770; Mon, 27 Jan 2020 01:41:40 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 27 Jan 2020 10:41:29 +0100 Message-ID: To: tyson andre Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary="000000000000198550059d1beaf3" Subject: Re: [PHP-DEV] Re: [RFC] "use global functions/consts" statement From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000198550059d1beaf3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Le ven. 24 janv. 2020 =C3=A0 17:10, Nicolas Grekas a =C3=A9crit : > > One option that I haven't seem much discussion on is the opposite: Always >> only look in the global namespace. Any unimported unqualified usages wil= l >> be treated as fully qualified names. This would match the proposed >> semantics for functions/consts and change the resolution rules for >> classes. >> I think this would have relatively little impact on how code is written, >> as >> classes already tend to make extensive use of cross-namespace references >> and the import is usually IDE managed. >> > > > Quick reaction: that'd make sense to me! > > Adding a "use CurrentNamespace\Foo" or using "namespace\Foo" looks easy > enough to adopt. > Does this mean you're suggesting to use declare(symbol_lookup=3D'global')= ? > Or shorter: declare(lookup=3D'global'), or maybe even > declare(global_lookup=3D1) as I'm not sure we need 3 options here? > Hello Tyson, can we please discuss this alternative? In another reply, you link to https://wiki.php.net/rfc/use_global_elements#deprecate_the_fallback_to_the_= root_namespace_instead But this new proposal derived from Nikita's idea is different as it doesn't need to deprecate anything. 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. declare(global_lookup=3D1) I think that's all we need to make all symbols resolve in the same way, known at compile time. 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. Thanks for considering, Nicolas --000000000000198550059d1beaf3--