Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108295 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20459 invoked from network); 28 Jan 2020 18:58:12 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Jan 2020 18:58:12 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1651A1804F6 for ; Tue, 28 Jan 2020 09:08:40 -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_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-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.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 09:08:38 -0800 (PST) Received: by mail-io1-f50.google.com with SMTP id i11so15105170ioi.12 for ; Tue, 28 Jan 2020 09:08:38 -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; bh=qfrjzK4SQiqgfT5PlhjXRciBCaVSwPYwDQWGsfR5NJ0=; b=MxBLN37OE8n5SRA5ObMtBV86+hsiW2u9YXrKEbncxBqRPJFt7PXTP53WheIqNybfO7 uFmT055pHfoi+Bw/OL4u19KPQ2IB56iz65MZf4YG3oLIETvDTVBhbfb2KhrBM8S6DN31 nvbXY9I3aAulOAPGNoV+6pN9efflzmfrVURQEOdUCbKMBWbZBCDBJ2Ptli8i3CJuV6gL BtS+M4NwrwSWbMqtPVXMV+Lr+zIvhQYhLL/E9tRh8BcawUJ58HHn05b8CMtCBdWeneLP fxkb2j+PoIidaqILI2gfJTA1+g1SJUzsbZJyc2/pPOrcw/ecKZf8PUsBVqws0FnDbuR7 If0g== 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; bh=qfrjzK4SQiqgfT5PlhjXRciBCaVSwPYwDQWGsfR5NJ0=; b=FBB4uCAFOt94TvIJNthuCwMBLX+ZcsbumpYRUjfWrObkFkV6iGYb2QlHAeFB0+weLU E2iGv3xRtPUlm82OlyzcGI7oLOwPxr1kjQLyHTwrV5tESgaQDps0JPIMCmMstpDUhoJe oYpxSXtOPzMGJI/3VZBreaBfm2G2SeX05zebFWoiOyBOBKwHb6QjdwoWmSUqr+Ymrod8 quBbqcnBktSUsvXFh6pcGAjAl9XoprBtGHhK4jW3aoggb59bvO87ykzfNosAwBcEzKFP IYtDxqP7gFQC7NnOUX5/HVmPcBmO6NuIrLWXCeK6tV4KDB8dPA/MEYBbStVC3gupTsJi M6ng== X-Gm-Message-State: APjAAAV+b1UMsahLRqmhQltW00z8MHxP/YO712TX2Z3abtVraaUCzpan +rFWJgixYaJDc6+bDfFC9FjMwy+a1iJqcgNqd39qDPej X-Google-Smtp-Source: APXvYqycon13ry3c958v+KPhWwKLGcYBInCFF7+wzJhaUW85m86FhkcEH9TOzqMj88VvK+vL8fvD0uHMxAPRiz69HTY= X-Received: by 2002:a02:cc75:: with SMTP id j21mr18375602jaq.113.1580231317969; Tue, 28 Jan 2020 09:08:37 -0800 (PST) MIME-Version: 1.0 References: <2d50c8c0-cbd1-0a0e-4098-eb00facf86db@gmail.com> In-Reply-To: Date: Tue, 28 Jan 2020 17:08:26 +0000 Message-ID: To: "internals@lists.php.net" Content-Type: multipart/alternative; boundary="0000000000005ede05059d364602" Subject: Re: [PHP-DEV] [RFC] "use global functions/consts" statement From: rowan.collins@gmail.com (Rowan Tommins) --0000000000005ede05059d364602 Content-Type: text/plain; charset="UTF-8" On Tue, 28 Jan 2020 at 15:42, tyson andre wrote: > > In other words, we don't need to know what the future modes are to know > what modes we have *right now*, and give those modes names. > > If strict_types had a name instead of a number, we'd have a similar > argument > over whether there should be a `strict_types='off'` vs `='default'` > and `strict_types='on'` > I have always read 0 and 1 as meaning 'off' and 'on' in that context; the idea that 0 could mean "whatever the current PHP default is" is completely new to me. (I actually find it slightly unidiomatic for PHP to use a number rather than a string there.) > - Confusion by new developers over whether `'fallback'` is weaker than > omitting the option. > What do you mean by "weaker"? A value of "fallback" would mean "I expect function calls in this file to refer to the same namespace if possible, and fall back to the global namespace"; no more, and no less. That feels like a well-defined and useful assertion. A value of "default" would presumably mean "I have no expectations about what function calls in this file should refer to, and am happy for PHP to arbitrarily change their meaning in future in undefined ways". Why would anyone want to assert that? > (e.g. if `count()` uses a keyword that's always the global function, > like `empty()` currently does, as an unrealistic/undesirable example) > ... > If php changes the default casting behavior to forbid weak casting boolean > to string > or string to boolean (as another unrealistic example), I personally > wouldn't expect strict_types=0 to be required to allow it. > Let's flip those examples around: what if we want to make some magic function always resolve to the current NS even in function_and_const_lookup='global' mode, or a particular cast be allowed even in strict_types=1 mode? The two different modes for strict_types aren't even "old" and "new", they were both added at the same time, so there's no reason one should have a stronger BC guarantee than the other. Calling the mode 'default' won't stop people's code breaking if we change the resolution rules, and won't mean we can just ignore breaking changes, any more than if we hadn't added the mode switch in the first place. All it means is that if we change the default *mode*, it's unnecessarily difficult for people to migrate (see previous example scenarios). My worst fear is that we add this mode labelled as 'default', but actually tie it to the current behaviour, so that we eventually have a mode called 'default' that isn't the default. This happened to Wikipedia: they named their default skin 'standard', then regretted it when they changed the default to be something else. Regards, -- Rowan Tommins [IMSoP] --0000000000005ede05059d364602--