Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106954 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 16429 invoked from network); 12 Sep 2019 16:37:03 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 12 Sep 2019 16:37:03 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 6515B2D1FE8 for ; Thu, 12 Sep 2019 07:12:58 -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-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) (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 07:12:57 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id r4so54890443iop.4 for ; Thu, 12 Sep 2019 07:12:57 -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 :cc; bh=eKjbqn8QIUqJ4A4UnZnz1vrBTkjsXCuCX6g0RO18EI0=; b=JXPtrou/MusTXkTJeHRtRObIJ1xEn1eYA+d4lHcN12kpeJFtCq7kUMy9coCMkCj8ET 575W2EzU3tcmwgWVVQ9b6o+wIJ3ryCjoA8xqUqjUBl/F2ddZDUpusbsHeSh5+Tbe1QkZ CJWPVQS+gFrMEYmb4q2pgv5zBKfRAD6oG9Ke0eX6bEWQ8IbveOvZ850wQ08A1Wi2xK/y aU9jt948PxZ02LWWdeIdUxnOKvp2DjGNHYQcOAhxWA39cdrviEou/YiE2x5RP0vS2jcD 78zzvxfFzn6ZgT+3k7Sxw3X2uWh5ryuWX1yo3NWKZWk/Fd27giGdjxhW/0XYBIlfiCJ3 mCGA== 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=eKjbqn8QIUqJ4A4UnZnz1vrBTkjsXCuCX6g0RO18EI0=; b=YONW1xuHkySnQoZBTL58mCaKFKC0kx6HG386DIm6Cght7lOyMoMWK+BknZYGKuPA2r j6y8c5bbnCtXkxofb07G3SbgdMlfekJ0kLdKqm+WwosrC+1mIEfYR98Pfxj1qixxr/y3 f7N5oB/gUoE+CeftQBJnaa1xUqBXt02/Arm9s8TJk31JTokSYQkdhwyGvuCTxw6yDcVo EGIi9OEVmGpWtQJfhBux3qWFC+I4MhbuZFF/n2H3MhrpDgapfPliemLURVABTsm4HBvJ Mz+AhB8M6tVSuvxTV+gq5HA0Vkj7RGJdXl4YU6JmlWSAp0bgxLf78NklnvfnF8krqqYc RnKg== X-Gm-Message-State: APjAAAVx2K2gZW/zF280FfVGbi+V0V/BDOe9qGcKt1WXJWgw2AFyclqw jeAJZRH/rqsZ+jECC+fJARByJd71uT+z64z4CGo= X-Google-Smtp-Source: APXvYqzmvpJrtPpN9oFpL7deCIJpD2CLC7fUpD809Al65ApuVBsnP/2KzOZFTyLXo6iXOHrsYKcFQ1FT3gTF2sUxvkE= X-Received: by 2002:a02:7009:: with SMTP id f9mr44045841jac.81.1568297577148; Thu, 12 Sep 2019 07:12:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 12 Sep 2019 16:12:45 +0200 Message-ID: To: Claude Pache Cc: Marco Pivetta , Rowan Tommins , PHP internals Content-Type: multipart/alternative; boundary="000000000000fcf76505925bbb84" X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: benjamin.morel@gmail.com (Benjamin Morel) --000000000000fcf76505925bbb84 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable >> $foo[$key1][$key2] =3D ($foo[$key1][$key2] ?? 0) + 1; > That violates blatantly DRY (twice the exact same lengthy expression `$foo[$key1][$key2]`), so it is not a satisfactory solution. $foo[$key1][$key2]??++ =F0=9F=98=83 More seriously, yes as Marco suggested, yes we can already do it, and as Claude pointed out, yes that's verbose. What I had in mind with language support is some kind of code-level (per line or block) switch that would allow uninitialized array keys to behave in a certain way, *depending on the context* : we actually have not one, but two good examples of this above, provided that $key1 and $key2 do not exist: - with [], an unitialized key would be initialized with an empty array (already does that) - with ++, an unitialized key would be initialized with 0 Without the proper code-level switch, we could safely have both cases above throw an exception. =E2=80=94 Benjamin --000000000000fcf76505925bbb84--