Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109564 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 82594 invoked from network); 8 Apr 2020 14:44:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Apr 2020 14:44:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E3C131804C7 for ; Wed, 8 Apr 2020 06:12:23 -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,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-vs1-f49.google.com (mail-vs1-f49.google.com [209.85.217.49]) (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 ; Wed, 8 Apr 2020 06:12:23 -0700 (PDT) Received: by mail-vs1-f49.google.com with SMTP id a63so4611062vsa.8 for ; Wed, 08 Apr 2020 06:12:23 -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=arBm9CXeXSd1NdPzo304IEWyI8ciNOgmYvWAieoPyY8=; b=M6r6sA7+VMyY3fseggRPdeRr4L7ttd3ULFgR9yOQpzPP7uBMaPEkuBqsxikB7YTGYi L17XunB6/fmyOAIrfx2K5hDB8OSEu7cowe2j1UrO4pDH0btV2gTWWq6sE/fP/1RmwudB Y3CX44w+j3xwY53kEEJ4x9J7YvfQFFc8c0Rry7q3HtpCCQaKfhQOp5QqnCnyrybKBpX7 /eBPjru/suu7iuc9rtLaFEEz7kRb6Y+I4uqPhyss7RRMRybJsJj82r72sKgfX5Qm1Bcf tZplmEYnkFxvNk9Q/QvfjkkDWSP4rpf9+xWC6Vw58eqa1JKPUJanBNSvG5YigL9ITBjs a0KA== 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=arBm9CXeXSd1NdPzo304IEWyI8ciNOgmYvWAieoPyY8=; b=L7Osj8ESNjI36tkLiLB7q9fr7Jq9vhZnrFl9RQV9ixZdktwYOFGU8Ac3tTbN6qbkJB CfsYZbX6KTBikjHwsl4728aAo/Imi3oEqtqunKKhwlkPFZD7elz8HedBzKu2cdjh8ph0 VWGOay1RWRN0EalQhWCUI4fA4mMZIqb5ZWOAy8JGHbFdiHU5I6Ot1hqYCYmr9BLoZYXH 9G3EJquTDr829sYkt/t4QGjP24ETc2x3iR/SDY+X7w96TtnhyeHoFHRM+/nUO2DwZBrI 5eRGCUXY1NEoNS4q1s5lH1DW/hwfdl186m/YKpef8tmpulhauaHgh4Da8e3/lyTP/agb L69Q== X-Gm-Message-State: AGi0PuYOisCG2GKCofgMLiuqimPNy3dGmrEKrgBP7gBS7HeS4xLfzpSv xBVkK+03CZztugnPjCp4v+ZkaJQdtE2snWp9di+l7ijP7YA= X-Google-Smtp-Source: APiQypL/MAKKOi0eyRK4lzIz/D3oQrpSO2jBR3aYhBvsurVHmOoSS1PTKeDpfL+lglXlWCOwLDtNknx8QUczRJ2bEn8= X-Received: by 2002:a67:fc4b:: with SMTP id p11mr5712632vsq.135.1586351541187; Wed, 08 Apr 2020 06:12:21 -0700 (PDT) MIME-Version: 1.0 References: <5e87a7aa.1c69fb81.2e0a2.74daSMTPIN_ADDED_MISSING@mx.google.com> In-Reply-To: Date: Wed, 8 Apr 2020 09:12:09 -0400 Message-ID: To: Andrea Faulds Cc: PHP Internals Content-Type: multipart/alternative; boundary="00000000000019f75205a2c740c3" Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Change var_export() array syntax touse short hand arrays From: theanomaly.is@gmail.com (Sherif Ramadan) --00000000000019f75205a2c740c3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable So to recap on what's been discussed so far, because I plan to bring this to a vote next week... I am updating the RFC to reflect that the change will no longer break backwards compatibility. I will be adding an flags argument with the following 3 optional bitwise flags for var_export: - VAR_EXPORT_SHORT_ARRAY [Triggers short-array syntax] - VAR_EXPORT_NO_INDEX [Discards numbered indexes in arrays (only if they are sequential from 0)] - VAR_EXPORT_NO_WHITESPACE [For one-liners] This complicates the implementation slightly, but I think it brings a greater net-benefit. On Fri, Apr 3, 2020 at 5:19 PM Sherif Ramadan wrote: > > > 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 optiona= l >> >> parameter called "$short_array" or whatever that defaults to false? >> Then >> >> 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 >> indexes >> > 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 >> rather >> > this stuff live in userspace. Just because PHP's penchant for >> > including the kitchen sink is broken already doesn't mean we should >> break >> > 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, = simple >> 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 >> >> --00000000000019f75205a2c740c3--