Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112772 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 71699 invoked from network); 6 Jan 2021 04:06:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Jan 2021 04:06:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ECF851804C6 for ; Tue, 5 Jan 2021 19:42:35 -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.0 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-oln040092004031.outbound.protection.outlook.com [40.92.4.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 5 Jan 2021 19:42:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=isf8EDy9NXLo6raPWLX8sLAbg9JheEpKbz9KoRV0jg7AD3DSjlHEhg916bzi21f3aKHH6+9RRqd/y2iu3R21SiXcpUFXXsGKG+IU5XPT60H4nblCb6NdykHfJMKUCjJtyY3pV9BYe9uu2p0GQmQn2UFjMiiTEHMdx5vqcbZ3T0RBbfbstSL3j80kcwcwoB3dZ97YQTZov1pGChzJENv+eqZMZso7joxCpXjQOdLygIk7OWbHHWEJwQRLa4/VlzuA1itV9b35UKopWY/Obs1qDI/HihSy0gJPlCfH+nzMpvEOizdhC/wkGg0bbLVp3Ij29RXlLrWpPTxRIXGj1aX8Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q8hzKWXSZTqgVGjZNFzA4MjMuynQkFTf6ku7Ip3LDYs=; b=QTBvE5NDhjAsBGe9YAc3C6NjelpU0t4uQs64cksA9ghOJZHEfEM6lWnh6s5r9cQM46holDf/cs3c0KyPHSjE//JKDm+guNZwxYdsXFILVZLyPCW+aD9poH+NJ+TT5Ev7IAPCDqPzzYQLSKaHN5EkTmedZ42c4r+OguGslYYgX/qCDT91mYzVAeLZhKdi0hSLRddo52aUEaZi6MYnZDZnVJQEgM6UfKJ4KFlNqt/xdVoYdUz5QTYM3nrljdBGC5aZ1Pvy0QIM+CxFS5w0G2gSlkwUSbyYRaz1cw8PibPqsnjvJZU9p39ypnYsGIBJUv0mWYpqnIyXXOp6oYtczeTExQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q8hzKWXSZTqgVGjZNFzA4MjMuynQkFTf6ku7Ip3LDYs=; b=PC9hKtg+zYzUUd8VgHPBStR3w58Vwz/zZozkWeWqFNrvt1bJuvvlZ7pZora4nW9UwuRj8XvxkvZ93iTiDANFebfB1c8G/q1FyFi0pNW56dJGZJ6OSkUX4XPap1FL9zgie7HEJmDD/CsXx72m9OwW/3pOx91BPdnMxMj+GCn+TyRpGqIL6LlEYDycNkjJo1Ek2pr9iJy46KZtpCCDIAbqe8fvowpWpsM/kr0HTMrbCNVn9l9z577vSJj0eF50wb8OY1/oVF/SNnDEWBNwTN0hKcxqCMuidNJF/IwkCuKYuxqh3KdvzfsZ8adEywEcldgWLEhZW5W47xg1xLZA56mWRA== Received: from SN1NAM02FT040.eop-nam02.prod.protection.outlook.com (10.152.72.59) by SN1NAM02HT172.eop-nam02.prod.protection.outlook.com (10.152.73.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.24; Wed, 6 Jan 2021 03:42:33 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com (2a01:111:e400:7e44::4f) by SN1NAM02FT040.mail.protection.outlook.com (2a01:111:e400:7e44::195) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.22 via Frontend Transport; Wed, 6 Jan 2021 03:42:33 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::b4c4:dc11:5337:821d]) by DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::b4c4:dc11:5337:821d%4]) with mapi id 15.20.3721.024; Wed, 6 Jan 2021 03:42:33 +0000 To: "internals@lists.php.net" Thread-Topic: [RFC] Configurable callback to dump results of expressions in `php -a` Thread-Index: AQHW1x7Yg3FUP/hma0qSEEKC7GDKEqoaCdKx Date: Wed, 6 Jan 2021 03:42:33 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:74590EE3CFF6D8D636AEECABAD888976D477F6D2110D465954EF680524056039;UpperCasedChecksum:B2CD0BA1DEFEEAF9E69A5038DF8700F4932FDFCE1C13204C967C7346854A7ECA;SizeAsReceived:7100;Count:44 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [ly6yf9iBC8AMKN6fDcXalW7CD79aCmh+sBxawZij9ZXkjbfiTCGxT1Jr1qNNNCIT] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: ccdef9b1-3998-435e-b40b-08d8b1f51a17 x-ms-traffictypediagnostic: SN1NAM02HT172: x-ms-exchange-minimumurldomainage: externals.io#1648 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: jjGY7Y/e85IE52xNUF1Ua/7E28BJ/274XS3i5V8Hw6VytYQyHIT1/xqBIdFV/k9WXAT/ICJYGJHNnVwU7LVYGkmNRr3jR5+Yg/0iH/NZsh/Jj04G4gdzv+8NG3bqc5POGhjV7CtQIrtecTWEPwZP0qfQ8/M5+eHlVQezx6aSrkq4N+PHeRBtm0bLc3+ev7XyASl5rk721+fMn0Q0PyyelYod9HiETYGveTMnFxNYwpYH04cAj1o+aqTnU8HyZvU0rMFO0a/TEclAHHJE65DxSat+X6l4AQpj6b0uBn/pdGs= x-ms-exchange-antispam-messagedata: WSIG+LHHWd4/YLJ7r622/k6uqEtS3nUYk5aHMAtjJWgzGv8ZFAxg/gR5ktruDzns/c4k8WszmC+Qg/Nd5yNaSrF2J9aFdklBppmKJM91NGZRZwhi8NCf1+DqUSakwEc8pVkz/C7g59O+RDpCVpOYcIbph+Hi0s/cuRS6WvocIS5rVBXve8vz61CP43BY7zoQwi8DF6/1mJZ5pl3aKf0BgA== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT040.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: ccdef9b1-3998-435e-b40b-08d8b1f51a17 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2021 03:42:33.5040 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM02HT172 Subject: Re: [RFC] Configurable callback to dump results of expressions in `php -a` From: tysonandre775@hotmail.com (tyson andre) Hi internals,=0A= =0A= > I've created a new RFC https://wiki.php.net/rfc/readline_interactive_shel= l_result_function=0A= > adding a way to configure a callback to be called to dump the value of si= ngle-expression statements from `php -a`=0A= > (and an ini setting that can be disabled to prevent that callback from be= ing called).=0A= > =0A= > Many REPLs (Read-Eval-Print Loops) for other programming languages that I= 'm familiar with=0A= > print a (possibly truncated) representation of the result of expressions,= but PHP doesn't.=0A= > It would be useful to allow users to extend the functionality of the defa= ult interactive php shell (php -a),=0A= > possibly with auto_prepend_file or through use of command wrappers/aliase= s, or after loading the shell.=0A= > Prior to this RFC, there was no way to extend the interactive php shell i= n this way.=0A= > (I've seen https://github.com/bobthecow/psysh mentioned as an alternative= for php -a while investigating this,=0A= > but that's a shell written from scratch, and doesn't have some functional= ity from php -a such as tolerance of fatal errors)=0A= > =0A= > Because PHP's interactive shell is written in C, adding new features or b= ug fixes is inconvenient - it would require a lot=0A= > of time getting familiar with C programming, PHP's internals and memory m= anagement,=0A= > and with PHP's internal C ast representation.=0A= > It would be easier and more accessible to extend PHP's interactive shell = through code written in PHP rather than code written in C.=0A= > =0A= > This was among the proposed enhancements I brought up in https://external= s.io/message/111073 .=0A= > An earlier version of the implementation was also created months ago -=A0= https://github.com/php/php-src/pull/5962=0A= =0A= Some of the feedback had mentioned that adding the ability to dump the resu= lts of expressions in the default shell=0A= only made sense if there was a default implementation included with this RF= C.=0A= =0A= I plan to start a straw poll shortly, to measure interest with/without a pr= oposed result expression dumper loaded by default.=0A= https://wiki.php.net/rfc/readline_interactive_shell_result_function_straw_p= oll=0A= =0A= Thanks,=0A= - Tyson=