Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112973 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58767 invoked from network); 24 Jan 2021 19:06:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Jan 2021 19:06:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BAC581804A7 for ; Sun, 24 Jan 2021 10:47:15 -0800 (PST) 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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.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 ; Sun, 24 Jan 2021 10:47:14 -0800 (PST) Received: by mail-wm1-f42.google.com with SMTP id i9so2340646wmq.1 for ; Sun, 24 Jan 2021 10:47:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=j6a/TDDvKGimlznWMCqDSVCwdIDNyAq01CH3Nydh+TA=; b=ay2FvM1DASozdzQds95FOjP+iyUhY5bLf3NYMm0Ih3jB8M7CqIhfOAh7XeQE7XAh1w OCKja7GBaeEDvXaeDRSQJiYxlqniWO8QekyqDKdGzmdIXF3YtT/Oabuk8Y8fDMXjS2V0 oHBpLeuatB2b5Gw2k/5VQiFyYjn38gzhG3atFRU/mEpzwo6nsjXlcWurGWV7Dq15V/RR pWaeRzsPqQGrGGau6hal4gb/oxHhIwjPS/pi7Trgkac3xvSOm31OthaSfkxoHlbakmYO TgH1hSL0GwOgKy2kCdLei0Tqy0eDSj8uU0HNFCa8oVzWe5YuHMDeoDw0wLTiN3IgiSXA 1lMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=j6a/TDDvKGimlznWMCqDSVCwdIDNyAq01CH3Nydh+TA=; b=Lo++gAClrzjhnYk1SXx0XIhsuyLl1MLaZFmgi95g074NYjaFAIhoRer5mLdGNuARbq CY4QD2aZYx0AtZEj9qdLXo7kSEUJ0Y9efdVAiq0WnAzRfg1JQSTmoRzJkK30Bq1SWeWe GHaujXoVVojGe9JWeEalX6muayZMk6gNzNhxueUvq2u+6bTsvRVNFFyIcQSu1IAmalps UQ1xl49wCDmIZBovtRhzUuxX+GCk6nnFR9+ReyIQX33XIL5JfvyXOv3TyQpJLySGMsJG LnWTuIkprqjDpDGSHMf6H9Xo+m410eIveUslhFHM97lIY+I9x60GcozOPHNUVrsBmmdd or1A== X-Gm-Message-State: AOAM530/05KBCPN67gwz+LAhi0Dz8ns83dfP/cANcb+AiVAZkG5Rsfsg /4qoaXB4ivMiAAl+PL74tvvH2OmsmRk= X-Google-Smtp-Source: ABdhPJwhiDi1KsdOJBTvApRwaBuseF0cCQ8gh8DbS3q22x02yNs/h1eRjPt/i4OkaqymfBWSIxSPpg== X-Received: by 2002:a1c:545d:: with SMTP id p29mr1445603wmi.2.1611514033242; Sun, 24 Jan 2021 10:47:13 -0800 (PST) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id x81sm14206685wmg.40.2021.01.24.10.47.12 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 24 Jan 2021 10:47:12 -0800 (PST) To: "internals@lists.php.net" References: <5ae166a8-378e-b3bc-056a-8ccf4f3a1ddd@gmail.com> Message-ID: <8e5d376c-0d7d-bf1b-bcca-3f8c4c737a22@gmail.com> Date: Sun, 24 Jan 2021 18:47:10 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Re: [PHP-DEV] [RFC] var_representation() : readable alternative to var_export() From: rowan.collins@gmail.com (Rowan Tommins) On 24/01/2021 16:17, tyson andre wrote: > Even if a developer such as yourself doesn't need to generate code and don't expect to directly use it, > **some of the applications and libraries they do use everyday would need to generate human and machine readable code.** Sure, I believe you that there are use cases for a function that exports PHP code. I remain unconvinced that there is a need to have *two* functions for that purpose, which differ only in a few cosmetic details. > **php-src phpt tests are for tests of php itself, which puts strict and atypical limitations on the test framework.** > php-src's phpt test framework may represent needs of php-src and some pecl maintainers, not userland. I'm not sure what point you're trying to make here. You were the one that mentioned php-src tests as a use case, so I looked to see what they currently use; the answer is *overwhelmingly* var_dump. > Still, I would prefer using var_representation over var_dump in phpt for many use cases, especially with VAR_REPRESENTATION_SINGLE_LINE available. In the previous thread, you agreed with Sara that var_dump should be "left out of this". Are you now saying that the new function *should* replace some uses of var_dump? If that is an aim, should we look at what other differences there are between var_dump and var_export, and how we can make this new function cover more use cases? > For a new developer, they may not have those features or plugins installed in their IDE, > or may not be aware of the existence of the shortcut/command to invoke those features on a range. I contend that a new developer would very rarely have any need to use this functionality at all. > Additionally, scripts to reindent may not remove the `0 =>`, `1 =>`, etc, > either not containing a php parser or assuming the user deliberately added those keys. And maybe they'd be right not to - that's an unavoidable problem with any formatter, it won't be universal. And that is why I'm sceptical of this function: it seems to be mostly a different set of arbitrary formatting decisions, which some people will prefer and some won't. The only part that feels like fundamental value is escaping control characters, which could be added to var_dump and/or var_export and only affect that minority of a minority of usages which are relying on the exact output in cases where control characters are present. Regards, -- Rowan Tommins [IMSoP]