Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112938 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 94609 invoked from network); 20 Jan 2021 16:20:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Jan 2021 16:20:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C04841804D3 for ; Wed, 20 Jan 2021 08:00:14 -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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (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 08:00:14 -0800 (PST) Received: by mail-io1-f44.google.com with SMTP id e22so24100922iog.6 for ; Wed, 20 Jan 2021 08:00:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benramsey.com; s=google; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=Whh8U6Koj8mgLf1PW5EVUsLRvK9IOeDvuvyg8cNNjqs=; b=G1V7dNrMk+dHijspT4fivVi9qVI6DQIalKhU/HiA4VzMDeJ3jO7ZbmYKHmrRT9lGP/ vzLldP0G9zzq4x5hXfXPICaBDwpGCWWILupbyWIdKkYj56O1PSWisCqvRuyyU1SUvCwX 0ZQ3QhOokJRRQ5G2DSsfiO5swKZlpaCBdusWUAuxXYQrLoR2n+MYp7q3vS6slvssPHhW itmNE17+dfK7uYcxCi30QGiA0BQdVKWhafYC6bgXJpGlxPJMEnCs9q2tDsq1LopKpEgk S+B+o6j4prXhPTgw+85tLx+fW5aa4Mgm/fjs+PwjJ6F7hM6slzvAGZjgoU/ce+gYUzi+ /BBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=Whh8U6Koj8mgLf1PW5EVUsLRvK9IOeDvuvyg8cNNjqs=; b=T4ZW6oNnuHwn91eXUSxtPnG81mW60WrR1mC+hwPUYgWg7wkvGIW7ZNfddv/9Du/KJx PXECyarBFOwcSYF5RAYIFR1lQNEKf+9I/YVo/Yd/nh2WaIStTxyY/J96m5cBurCOz04X AcgFmiGKHxnHl75UuUToz4Bdez5Yz0fUJDBp6x7mu0Iw4v3EsOFWrFaW7LMRuBtpuu61 1jXDOr9q1ltCKpLwhzEIEDyCYPRUoK8K24dM+xIE0RmuMaFJsKyBUexSunscwogX81UF d1jFl/ljQTg63GS3wSMpH2Bg3GQgqn7zAtJlLUc3iMLe9r8VldMh0fS9jUKHHgjr6LRx NsSw== X-Gm-Message-State: AOAM532s/b2QjKamResKpJFwRGKK9fryJ1oPyTl5FyGBDPOTAOk3n6J0 1NWESs1rl1QtruTwa29xdRChxw== X-Google-Smtp-Source: ABdhPJzyepnBM8sivh74tVMUZUO1FcjZhL9g93eBRU2IcL6ExtB+eZIh8Cglg9BqJxu9pgKJwHY80w== X-Received: by 2002:a6b:d20d:: with SMTP id q13mr7332726iob.71.1611158413450; Wed, 20 Jan 2021 08:00:13 -0800 (PST) Received: from [10.10.42.56] ([96.61.105.82]) by smtp.gmail.com with ESMTPSA id r12sm1222128ile.59.2021.01.20.08.00.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jan 2021 08:00:12 -0800 (PST) Message-ID: <82B0816A-448C-4862-994F-2CFD6B12EE30@benramsey.com> Content-Type: multipart/signed; boundary="Apple-Mail=_E4DDFB67-D85F-4A62-BDFB-C07EE568BF05"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Date: Wed, 20 Jan 2021 10:00:11 -0600 In-Reply-To: Cc: "internals@lists.php.net" To: tyson andre References: X-Mailer: Apple Mail (2.3654.40.0.2.32) Subject: Re: [PHP-DEV] [VOTE] Dump results of expressions in `php -a` From: ben@benramsey.com (Ben Ramsey) --Apple-Mail=_E4DDFB67-D85F-4A62-BDFB-C07EE568BF05 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jan 19, 2021, at 18:55, tyson andre = wrote: >=20 > Hi internals, >=20 > Voting has started on = https://wiki.php.net/rfc/readline_interactive_shell_result_function > on 2021-01-19, and ends on 2021-02-02. >=20 > This RFC proposes to dump the results of non-null expressions using = var_dump/var_export() by default in `php -a` (the interactive shell). > Additionally, this adds a new function = `readline_interactive_shell_result_function` to the readline PHP module. > This function only affects interactive shells - it can optionally be = used to set or clear a closure when `extension_loaded('readline') =3D=3D=3D= true`, > but that closure would only be called in interactive shells (i.e. php = -a). > (That closure would be called instead of the native implementation = with the snippet of code that was evaluated and the expression's result, > if a php statement contained a single expression such as `2+2;` or `$x = =3D [1,2];` (that could be used as the expression of a return statement) > - Dumping of expression results can be disabled using an ini setting = or at runtime >=20 > Thanks, > - Tyson I voted =E2=80=9Cno=E2=80=9D because I don=E2=80=99t think = `readline_interactive_shell_result_function()` solves a problem in a way = that is better than can be done in userland. It=E2=80=99s quite limited, = requiring the readline extension, and anyone who wishes to build a more = complex implementation will need to require users to add something to = `auto_prepend_file` or manually load something after dropping into = interactive mode. I had originally thought that userland implementations might be able to = make use of this to piggyback off of `php -a`, but Justin Hileman = (author of PsySH) thinks it=E2=80=99s not something that would be useful = to userland REPLs [^1]. > There=E2=80=99s still no way to do 99% of what PsySH does without a = userland REPL. This just makes the output look similar. I do think there=E2=80=99s value in improving PHP=E2=80=99s built-in = interactive mode with prettier dumping of expression results, but I = think `readline_interactive_shell_result_function()` will not end up = being used in practice. Cheers, Ben [^1]: https://twitter.com/ramsey/status/1347661890420428802 --Apple-Mail=_E4DDFB67-D85F-4A62-BDFB-C07EE568BF05 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iHUEAREIAB0WIQToXQMR3fpbrPOmEOewLZeYnIwHGwUCYAhTiwAKCRCwLZeYnIwH G7SiAP9nHErf5ZOteSip3yIoEP5wN3SkDUBqZSs68wxaoPgb5gD/R/k4y/Eb5Y7D DMcWxp8E6fymXr0/A2h/0vsQud1HLAU= =KQeS -----END PGP SIGNATURE----- --Apple-Mail=_E4DDFB67-D85F-4A62-BDFB-C07EE568BF05--