Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109525 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 22776 invoked from network); 3 Apr 2020 22:52:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Apr 2020 22:52:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8BF111804B4 for ; Fri, 3 Apr 2020 14:19:56 -0700 (PDT) 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,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-ua1-f42.google.com (mail-ua1-f42.google.com [209.85.222.42]) (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 ; Fri, 3 Apr 2020 14:19:55 -0700 (PDT) Received: by mail-ua1-f42.google.com with SMTP id a6so3305078uao.2 for ; Fri, 03 Apr 2020 14:19:55 -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=KCwfdXLOIThDkxRs8YNH+xXiFDpYOY4jtJwZcGYUmSw=; b=tXlJuAxAPWygNLKTOEKOj+VtxMsbXW/wlSXNw5246CRQkAOuZttTNgT6LCMsB/eEyu JNWzb9J0TIY4mBNFyxWkuu3V3vPiQIGM/3Kr1rswgF6X0ncUIhEPvYDVYuOEkQg/6gS6 jPjkimbFx2OMICw8Ri/ZgaCK2qUrJw0+TGuo1qJidlH7Vo3EVzD41zH/iBD1313cBt4j 6/wnbO2MeBOEiMbbsdQPBBHHTBSek523u3atZKe5jx5u0qCOqCvAnrQcYbcU/W8QuzOl zMI66IaGuNjoopFsuHQw34X3Z1JLalZRjlXBNKBD12Hpg9SYj5YV+ntgwguepR71qh2P hLog== 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=KCwfdXLOIThDkxRs8YNH+xXiFDpYOY4jtJwZcGYUmSw=; b=YMZrKGCLpUxtsqJJLNo0erWB/0OX+c7zKDcVCb5+bjzBdz+Mcy/mVb3zlVS9ps9xjt bwdUVg/QBlPDm4LUi5R3uuOst6bfEjTp1Y5yckqlRtX+p0iUhbtJW1GZ5GiJSjjImgR9 G27bF2uEX7RVrOhvGo8Qq6tORrdnxE8kZOrFPLHRTPuP9dOz3fGfcE02xplwT5GvLVqo 9ZGv6fGHZH2kQvWFvI6PpVThx484bJghgX0yb2pSEgRqeobK0t56ahakYtU58OG/E2hO 13xcAjfqV8tLnFRYvvT8ozz+XV6pa5Cu5kodZQbq8j5n4hYkm3Btz2AKzzPqlrC3LqIn S5vg== X-Gm-Message-State: AGi0PuZowClRU/TaaG26nL6dIgUFoV/l6ZtDoEHNJIwP2wcMIjiiItgb Y0T8CFvcGNqrec0+DaOKeUjoWS7QHh7h1szsrWNvCfgk X-Google-Smtp-Source: APiQypIcZDH5Q3hyIjHXXjkTu1MKZ4bxbsIzISaORJxDmNWNZp7M9m9Nghug46TycbI/oq+SYeQLrGbbDLIg2DduHa4= X-Received: by 2002:ab0:7406:: with SMTP id r6mr7916895uap.22.1585948790576; Fri, 03 Apr 2020 14:19:50 -0700 (PDT) MIME-Version: 1.0 References: <5e87a7aa.1c69fb81.2e0a2.74daSMTPIN_ADDED_MISSING@mx.google.com> In-Reply-To: <5e87a7aa.1c69fb81.2e0a2.74daSMTPIN_ADDED_MISSING@mx.google.com> Date: Fri, 3 Apr 2020 17:19:39 -0400 Message-ID: To: Andrea Faulds Cc: PHP Internals Content-Type: multipart/alternative; boundary="0000000000004b592105a2697a8d" Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Change var_export() array syntax touse short hand arrays From: theanomaly.is@gmail.com (Sherif Ramadan) --0000000000004b592105a2697a8d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Apr 3, 2020 at 5:16 PM Andrea Faulds wrote: > Hey Sara, > > Sara Golemon wrote: > > On Mon, Mar 30, 2020 at 12:38 PM Chase Peeler > wrote: > > > >> Just out of curiosity, is there any reason we couldn't add an optional > >> parameter called "$short_array" or whatever that defaults to false? Th= en > >> there shouldn't be any backwards compatibility issues. > >> > >> None at all, though I'd make it an `int $options =3D 0` similar to > > json_encode(). I'd have a FAR easier time supporting that than a > wholesale > > BC break for the sake of breaking BC. > > > > I can think of a few options: > > VAR_EXPORT_SHORT_ARRAY =3D> use [] instead of arrray() > > VAR_EXPORT_NO_WHITESPACE =3D> Keep it concise, single line > > VAR_EXPORT_NO_VECTOR_INDEX =3D> If an array is vector-like, skip ind= exes > > VAR_EXPORT_UTF8_UESCAPE =3D> Detect places where we can use \u{1234} > syntax > > for UTF8 strings > > > > Though I'm going to stay with my stated position that I would MUCH rath= er > > this stuff live in userspace. Just because PHP's penchant for > > including the kitchen sink is broken already doesn't mean we should bre= ak > > it more. > > +1 for me > As you say, including the kitchen sink might be excessive, but I think > adding a $flags option isn't a bad idea =E2=80=94 it's low-maintenance, s= imple > to implement and, in my opinion, would be frequently used. We can have > the best of both worlds: consistent default behaviour, and nicer output > for those who want it. I can see myself using VAR_EXPORT_SHORT_ARRAY and > VAR_EXPORT_NO_VECTOR_INDEX (not with that name=E2=80=A6) :) > *Fingers crossed* > (Also, if we make the output of var_export() more palatable, will people > use it instead of print_r() for development purposes? I can dream=E2=80= =A6) > > Thanks, > Andrea > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --0000000000004b592105a2697a8d--