Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106942 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 93534 invoked from network); 12 Sep 2019 15:54:10 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 12 Sep 2019 15:54:10 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 605C02C0454 for ; Thu, 12 Sep 2019 06:30:04 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Thu, 12 Sep 2019 06:30:03 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id k5so29220342iol.5 for ; Thu, 12 Sep 2019 06:30:03 -0700 (PDT) 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=HDdeydN11atSD7ua50S0W2raN76JgE8+cfvu5l0TJ+w=; b=X2pDEkAtOqpDip3uKBYbXKlS3WgCoNI0JPc1qDvLbvbh0607fkXhU/Pl+d1+Kg+tEE V3b3XP4rCA76ANqqjYnbZeachJeD6M41WqaM3iV0GdBpM12C1BmbtWASWLhPSIQjUUc5 CkRkKM4YeKkJTqVV2fQZdX9ZUKf0zeLdhCOIz7FznIxulYTS4PQ+oJ6vaF/Lnk6DSXK8 vWI4bCV/igX806lCZy6epCXzo/W4dVYEzH0AkolR16VIwy+XbC4F99HEm0ljN/WrxGti i5/sQRj7noh5bGgXMJMnLTJW/YfnmfpBsuzPR3GX4TsCyQaphLGZvl/WKQZaQ5wbYHeg tTrA== 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=HDdeydN11atSD7ua50S0W2raN76JgE8+cfvu5l0TJ+w=; b=tWYU1+NWUjf2TtROw+J8hwgkCmYbJY80G6B585s2exK3vPj2AsjBCWd60QoqGr6FXw m4WvqbIcVYOsNcxzy9dom2PRcr/j7Pgj0DFTsinuZKwa7V4+VUcWaEA/3uNHLmd9NiUe w4KeyLrnbDdeKK1fViLwxeVwmYZ12lQnFSNca0p/kQKRkvy2R3SfL5ksnfRzTf1iaAcN ZFmxaeyoYl2Zn1+U+vy10BTDWVorNpSg2yKHLdmS0inHw+QED5v/ChXaGu++w/rYgqiF cyCNXalcNu/ZEgLLve7qfzozD/MlrlO+4dy++bvZOLqp5zLeZ5LXcw/NALMFRvOqdNsE Rtfg== X-Gm-Message-State: APjAAAX4rrr+VFy61nEF4CGGv2WIxvE3bAJ4MQz51+ZpEJzNKQ1uTB5w HswGTkd8QvCzASgO2gb591WT0ZhhL9HA/h3v779Z1b9P X-Google-Smtp-Source: APXvYqz3tKsm6XTGTxYRUH9S/6ZQR6SrhvMAV/WYliqbat+6Y1SM7jin7cWZgS500zbgCGoICQSWBBApqDb7vbIEQR4= X-Received: by 2002:a6b:8dd2:: with SMTP id p201mr4733993iod.206.1568295002638; Thu, 12 Sep 2019 06:30:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 12 Sep 2019 14:29:51 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000890f9805925b22e3" X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: rowan.collins@gmail.com (Rowan Tommins) --000000000000890f9805925b22e3 Content-Type: text/plain; charset="UTF-8" On Thu, 12 Sep 2019 at 11:32, Benjamin Morel wrote: > I don't think there are that many such *potentially *legitimate use cases, > so maybe we could just list the use cases and think about a more elegant > solution to solve them? > Yes, please. If we can focus less on vague anecdotes and opinions *on both sides*, we can look at *making the language more pleasant to use*. For instance, for undefined array keys, what if we had an operator for "initialise and retrieve", such as $foo[? 'bar']. Then we could simplify ugly code like this: if ( ! isset($foo[$key1]) { $foo[$key1] = []; } if ( ! isset($foo[$key1][$key2]) { $foo[$key1][$key2] = 0; } $foo[$key1][$key2]++; With something safe but succinct like this: $foo[? $key1][? $key2]++; Unlike the error suppression @ operator, this is not saying "I know I'm doing something wrong, do it anyway"; it's saying "I want to do this specific thing, I just want to do it in fewer lines of code". The more helpers like this we have, the more I'd be amenable to *eventually* raising things to Error - although I still think that should be done over a longer period of time than a single release cycle. Regards, -- Rowan Tommins [IMSoP] --000000000000890f9805925b22e3--