Re: [RFC] Configurable callback to dump results of expressions in `php -a`

From: Date: Sun, 03 Jan 2021 18:44:32 +0000
Subject: Re: [RFC] Configurable callback to dump results of expressions in `php -a`
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-112737@lists.php.net to get a copy of this message
On 03/01/2021 16:11, tyson andre wrote:
- The benefit is that dumping the result of expressions improves the default experience. psysh wouldn't be installed by default when a new developer is learning php through the php manual, or when sshed into a remote server.
It doesn't feel to me that you've really answered Nikita's question: if all the code using these hooks is going to be distributed as userland code anyway, then they're not going to improve the default experience. It feels like we need to go in one of two directions: a) Build a full-featured official REPL with all of these improvements completely implemented out of the box. Limited extension hooks might still be desirable to build custom versions for frameworks etc, but they could be more targeted - for custom input, it could be "register meta-command"; for custom output, we already have __debugInfo() at the class level. b) Expose the magic behaviour needed for something like PsySh to do everything php -a already can, and leave the rest to userland. So far, the only mentioned requirement is a special form of eval() that swallows fatal errors. My feeling is that the current mood of the community favours (b) rather than (a); the most obvious example is that PHP used to bundle a PEAR executable, but Composer remains an entirely external project. Is there a reason not to aim for the same "de facto standard" for a REPL? Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#112737) next »