Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106960 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 26394 invoked from network); 12 Sep 2019 16:49:55 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 12 Sep 2019 16:49:55 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id A68EF2C0327 for ; Thu, 12 Sep 2019 07:25:49 -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=-0.5 required=5.0 tests=BAYES_00,BODY_8BITS, 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-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (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:25:49 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id f12so54979977iog.12 for ; Thu, 12 Sep 2019 07:25:49 -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=72Mx8D1fSHtjz7Nazl+UaL2ydFtXUVG18RDT5Q/XpdQ=; b=VXfFBDpoEv9KkHj7JzgpUISsCni9JrTg0Oy735Hj4MtvV0dtpfeIljbwGXwBVxKTGI z2qvQ2oK2BTnA+yyjWa6cH5jD+b+BavVA7mklEL9eQWR0W+3TMYVTG+enx8HTSLEJO1I FbPHKTN9maXmaoObiTLhQKZ0vWFg6JMUDhmn73ToY/TbyIXnwvH9TNR3TizoXceMmGnl qiTmwqQY/FeyvUxIVlVFWgtHLhZvCjRKloVh2FBnr8i41J/QAUvKFWCM7DEPLQGB0IwP fhUev0lfepSkbKjENPKyyAy/XT+bS5M8f941924KQE1tfQCc1MWWDVn94iIbAjtsaDvM 9cWA== 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=72Mx8D1fSHtjz7Nazl+UaL2ydFtXUVG18RDT5Q/XpdQ=; b=ABGSljsa1eUrUY/sR6+jc7IsGwaxhZyi0YBOcVmRUJJusTIUI9QJXr+lU3eXqFYEYk cWDpu5YJNIpS/WLc4nUEaSc7PwylqR4GWjk6SEgTi24KyYH3y3jq3lVRH0CtdDnfPz5m XNWJ4HgBjG6J+CxJa3Tkprt2nJGZVYSS8VShj+WyJlkAjQnbl+tpiIV2P/haumPMpK5c YQ0gihz/TVxLisx0TFfMc4INL+tEB3a3Wq/U8IwbCJ0+IfiqYQ324TCPKQthAmU2u3YZ WdOoVOSGhqujL85Yd7x7GCWEAWwYUGaGIq6aGnX4qZgG7v1yyZDZS+Cs3i5ApG3RWOdY rlQQ== X-Gm-Message-State: APjAAAVbIRbeTYw7PMK5pkA5SM7tzyOkA05uwaNNYpDgIYRIXr50QU7+ LX6UCsTmyfYOuQ3Xf5TcJiXv49n//O2MdLR9r8pksZ9PPlQ= X-Google-Smtp-Source: APXvYqxzk+Y/dZpPwZ4ShwZQCtaDN9ubHjlZQ0hiuIev1a3FQSVZTcWOWWzMjI+k5YYp6Hi6DeuiaqZbnpm6szfe13M= X-Received: by 2002:a6b:7011:: with SMTP id l17mr4654002ioc.35.1568298348119; Thu, 12 Sep 2019 07:25:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 12 Sep 2019 16:25:35 +0200 Message-ID: To: Arvids Godjuks Cc: Rowan Tommins , PHP internals Content-Type: multipart/alternative; boundary="000000000000f10c8205925be929" X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: ocramius@gmail.com (Marco Pivetta) --000000000000f10c8205925be929 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Sep 12, 2019 at 4:02 PM Arvids Godjuks wrote: > > > =D1=87=D1=82, 12 =D1=81=D0=B5=D0=BD=D1=82. 2019 =D0=B3. =D0=B2 15:33, Mar= co Pivetta : > >> Hey Rowan, >> >> >> >> On Thu, Sep 12, 2019 at 3:30 PM Rowan Tommins >> wrote: >> >> > For instance, for undefined array keys, what if we had an operator for >> > "initialise and retrieve", such as $foo[? 'bar']. Then we could simpli= fy >> > ugly code like this: >> > >> > if ( ! isset($foo[$key1]) { >> > $foo[$key1] =3D []; >> > } >> > if ( ! isset($foo[$key1][$key2]) { >> > $foo[$key1][$key2] =3D 0; >> > } >> > $foo[$key1][$key2]++; >> > >> > >> > With something safe but succinct like this: >> > >> > $foo[? $key1][? $key2]++; >> > >> >> $foo[$key1][$key2] =3D ($foo[$key1][$key2] ?? 0) + 1; >> >> >> > This message contains a healthy dose of sarcasm. > > No sarcasm intended: question is about the verbosity and length of a *proper* (correct =3D no warnings/notices/errors, matches type expectations= ) checked solution, and I provided a simple one-liner that is both readable and correct. You can make what you want out of this, but there was most certainly no sarcasm. Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --000000000000f10c8205925be929--