Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108829 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90241 invoked from network); 3 Mar 2020 16:55:58 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Mar 2020 16:55:58 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3A132180089 for ; Tue, 3 Mar 2020 07:15:10 -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-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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, 3 Mar 2020 07:15:09 -0800 (PST) Received: by mail-lj1-f181.google.com with SMTP id u26so3911596ljd.8 for ; Tue, 03 Mar 2020 07:15:09 -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=rF4eNZDhiHNiivBWD20gsSUHjRP/bnsZI4h4Sh5Vawk=; b=BhUR6jwieK4TbradONTvgYB513BgVW4ZGRCFxRIfr21iTHQax95JSjk7ERWEBG8RhM yH5jy/PG3vmvCeSloYlofxeqgUP4GHV27gWHhoo5H7ESo+VsNYVAWuhaSwzp7SF7FH+b 6etj9T+GeRroB/ZmVnwoM14uGWBWKMDukWidk1YwXeRnN3upwhGjZUIF/6rVUQUChTfl TEWESWW/j+/BzdAx31CWlKxE6Hw5apJtuT3zqQqUFyEsOuJuykRxY1ojwQjUduZ0yEwX VDrpedcLARRfR5YEOHOHiasSljPH2oqpXxQbP5RFvUSiEYycLQZdfDQ9LzsgzwCxD2ko aymQ== 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=rF4eNZDhiHNiivBWD20gsSUHjRP/bnsZI4h4Sh5Vawk=; b=LmrleGYcGepqPW3caYD1eWT8fEuEFASyf880QFBQR02jjkc+3rG1yUUdyneUV0UK9c hgAC/Djaon2VldiSEz+01POn8QTb/q7r09gwhZcq5pdVN4z/Lj/64KDx+NGlx37J6yXw lR7jgXIN+xW7KI3ZOtXmMzyRR/1mOGmgbPD38Lg9WSBSNE5lecoleE7ttRLGczxV50vR 6R0r9FEU+AJSOU/AOKwXUI736kmnE0mD695oqoLJCvG2FzgDV1G4B5cQciqORGfK3vkK dp/DUDZ88+PFuQZZeTUmxhQjoHU+BbDUd+MeGxLsB/JwB4ulnlX0kU/vep9msMkmcD2Z LzzA== X-Gm-Message-State: ANhLgQ3lM14Xsz7WoxpFz61VWoxFwxSFyLBmdW7zDwTtXPmjlmmOkgc9 em/QMpi/7gUPUiKxKcbi9+zTqCm9IAVOw94v3zU= X-Google-Smtp-Source: ADFU+vtwyzAIyDLibLBEurS/OBtVWFmVicF/XA/sWMPvp2oZEtWVJK6+X/nEFS4nFAHtIroEcq2B/BHV5t2T486sZCE= X-Received: by 2002:a2e:7806:: with SMTP id t6mr2814254ljc.145.1583248507560; Tue, 03 Mar 2020 07:15:07 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 3 Mar 2020 16:14:51 +0100 Message-ID: To: tyson andre Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary="000000000000e264c0059ff4c4d5" Subject: Re: [PHP-DEV] Straw poll: Places to allow function calls in constant expressions From: nikita.ppv@gmail.com (Nikita Popov) --000000000000e264c0059ff4c4d5 Content-Type: text/plain; charset="UTF-8" On Mon, Feb 17, 2020 at 3:09 AM tyson andre wrote: > Hi internals, > > I've created a straw poll at > https://wiki.php.net/rfc/calls_in_constant_expressions_poll , to measure > interest in allowing calls in different types of constant expressions. > If there aren't any problems with the poll structure or rules preventing > creating a poll, I was going to add it to the rfc index page and move it to > voting. > > This poll was created to gather opinions on which of the below statement > types would be desirable to change, and in which ways, before rewriting > https://wiki.php.net/rfc/calls_in_constant_expressions . > It seems desirable to change some of these expression types (e.g. > parameter defaults, static properties, static variable defaults) in > different ways from others. > (e.g. forbidding static property declaration expression results from > containing objects seems like a completely unnecessary limitation from > trying to reuse the implementation, in retrospect). > This poll was created for feedback on whether changes to the following > places had support, and what types of changes there were interest in. > > - Initial values of static or instance properties. This poll only > addresses static properties. > - Parameter defaults of functions, methods, and closures. > - Class constant values. > - Global constant values. > - Static variable default values. > > I'd asked earlier about creating a poll in > https://externals.io/message/108430 , but didn't receive a response. > > Thanks, > - Tyson > Hey Tyson, I feel like the results of this poll aren't going to be particularly meaningful, because it gets too caught up in the details and loses track of the big picture. If you ask people whether they want to allow function test($param = some_call()) { } they're going to to tell you "no", because that seems pretty esoteric and most people likely do not see a use-case for it. If you ask the same people whether they want to write function test(Dep $optionalDep = new Dep()) { } instead of function test(Dep $optionalDep = null) { if ($optionalDep === null) { $optionalDep = new Dep(); } } a lot of them are probably going to tell you "yes" now. The question didn't really change (new Dep is just a different type of "function call"), but the perception changes a lot. This is also why I think the focus on plain function calls in particular is somewhat detrimental. This is one of the cases where going for a paradigm shift (constant expression -> any expression) is "simpler" than doing an incremental change (extending constant expressions to allow function calls, and all the subtleties that entails.) Regards, Nikita --000000000000e264c0059ff4c4d5--