Hi internals,

> I've created a new RFC 
> https://wiki.php.net/rfc/readline_interactive_shell_result_function
> adding a way to configure a callback to be called to dump the value of 
> single-expression statements from `php -a`
> (and an ini setting that can be disabled to prevent that callback from being 
> called).
> 
> Many REPLs (Read-Eval-Print Loops) for other programming languages that I'm 
> familiar with
> print a (possibly truncated) representation of the result of expressions, but 
> PHP doesn't.
> It would be useful to allow users to extend the functionality of the default 
> interactive php shell (php -a),
> possibly with auto_prepend_file or through use of command wrappers/aliases, 
> or after loading the shell.
> Prior to this RFC, there was no way to extend the interactive php shell in 
> this way.
> (I've seen https://github.com/bobthecow/psysh mentioned as an alternative for 
> php -a while investigating this,
> but that's a shell written from scratch, and doesn't have some functionality 
> from php -a such as tolerance of fatal errors)
> 
> Because PHP's interactive shell is written in C, adding new features or bug 
> fixes is inconvenient - it would require a lot
> of time getting familiar with C programming, PHP's internals and memory 
> management,
> and with PHP's internal C ast representation.
> It would be easier and more accessible to extend PHP's interactive shell 
> through code written in PHP rather than code written in C.
> 
> This was among the proposed enhancements I brought up in 
> https://externals.io/message/111073 .
> An earlier version of the implementation was also created months ago -  
> https://github.com/php/php-src/pull/5962

Some of the feedback had mentioned that adding the ability to dump the results 
of expressions in the default shell
only made sense if there was a default implementation included with this RFC.

I plan to start a straw poll shortly, to measure interest with/without a 
proposed result expression dumper loaded by default.
https://wiki.php.net/rfc/readline_interactive_shell_result_function_straw_poll

Thanks,
- Tyson
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to