Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112943 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 11217 invoked from network); 20 Jan 2021 19:10:57 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Jan 2021 19:10:57 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9DB5D1804F2 for ; Wed, 20 Jan 2021 10:50:59 -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=-0.2 required=5.0 tests=BAYES_20,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-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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, 20 Jan 2021 10:50:59 -0800 (PST) Received: by mail-wr1-f54.google.com with SMTP id q7so2158933wre.13 for ; Wed, 20 Jan 2021 10:50:59 -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=zl9lJji8uJSoq5OZmBu0NiNNGldSI7GhYEAb/18O9Jo=; b=TiK2rxyc4ni7Ie7QmqXMv+7N07T3rG4DZ7ifi1zgptOX+oQnhlfdeyWiRzwdG2kqCQ 4CeW14W2QH8njY51hcGCxSIWp26/5BOXXN69XjT9IqYSpvgG2JYSh5nmJ/wCmeA0wzQT 0LWus2UuMWXl5ryJUdwIgdqj7908S7kwtpd84NkNv7vwuynOYk/sJ+ZrKUD9iGD9Y1Xs DZtubeR7rTN78HBZSIQYoJ9FDsvdel5QNBazvJ1UdSSqluW6h1aWLJs61wErucedRnrT w8cNJ2axfobxWliuT4MiDirjuH950PHGR5bmnCWx+TcJqF2jKm1Jc9QmijMCuEB2JFaB m4EA== 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=zl9lJji8uJSoq5OZmBu0NiNNGldSI7GhYEAb/18O9Jo=; b=Zn6AGYsUOHLORgJt1XL/n6i7z53772fNXDXu/Iikej3VE6R6ZncVheWli+a2aW6P/w pG71AKLyjGneGEKCaLgfRMhqxlp8pkORl+UJfTICwp1/huyXM6Qf8GP9l7BVxtoI3Jqs yoi4hsmEYRFe299xNCW688F3iA8kzLH3kuV2ZD4CPwEH1Sj4C9zk3O+dnCzxY0idqfjY 149LljNrtsNg0BCpCFyn3H2UGANc/ptFXDmCwu61P+fAvtGl2ibBxHRG2TavOHju1zc2 tGrzxjQwiBc7DSDHBA+ps5xuIMObp2gm6oGax5h7WcOzavT9bOQ1pX7i+64WcBe/0Vw0 2rJw== X-Gm-Message-State: AOAM530bwgkayRPisg5KXj55Phb/xNTyKm/YM0aXc0r9KRGPXzm4wJyB TwojXPBd/C4825j9Adnag/WeJ6FV1JI= X-Google-Smtp-Source: ABdhPJyV7nN27hj/XMhdUnQWEH8dL9GqSkkmQWo4TcuBCLWRXN7Pc8iqGAyfa/T96ov4T8I80Da3uQ== X-Received: by 2002:a5d:4902:: with SMTP id x2mr10542590wrq.272.1611168653959; Wed, 20 Jan 2021 10:50:53 -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 m18sm5812535wrw.43.2021.01.20.10.50.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Jan 2021 10:50:52 -0800 (PST) To: internals@lists.php.net References: Message-ID: <22e7ebcf-3f98-ff74-8d84-d2b50cda44b7@gmail.com> Date: Wed, 20 Jan 2021 18:50:52 +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: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] Proposal: short_var_export($value, bool $return=false, int $flags=0) From: rowan.collins@gmail.com (Rowan Tommins) On 18/01/2021 21:12, tyson andre wrote: > Thoughts? > (e.g. for the name, short_var_export() seemed more appropriate than var_export_short(), pretty_var_export() or canonical_var_export()) While I agree that all the suggestions in this thread would improve var_export, I worry that it is failing a "smell test" that I often apply: "If you're struggling to come up with the appropriate name for something that you're creating, maybe you're creating the wrong thing." In this case, the reason it's difficult to name is that PHP already has rather a lot of different ways to produce a human-readable string from a variable. The synopses in the manual aren't particularly enlightening: - print_r — Prints human-readable information about a variable - var_dump — Dumps information about a variable - var_export — Outputs or returns a parsable string representation of a variable Then there's the slightly more exotic (and rather less useful than it once was) debug_zval_dump; serialization formats that are reasonably human-friendly like json_encode; and any number of frameworks and userland libraries that define their own "dumper" functions because they weren't satisfied with any of the above. The name of any new function in this crowded space needs to somehow tell the user why they'd use this one over the others - and, indeed, when they *wouldn't* use it over the others. Should we be aiming for a single function that can take over from some or all of the others, and deprecate them, rather than just adding to the confusion? Regards, -- Rowan Tommins [IMSoP]