rfc:readline_interactive_shell_result_function

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:readline_interactive_shell_result_function [2020/12/20 22:17] tandrerfc:readline_interactive_shell_result_function [2021/01/06 03:27] tandre
Line 3: Line 3:
   * Date: 2020-12-19   * Date: 2020-12-19
   * Author: Tyson Andre, tandre@php.net   * Author: Tyson Andre, tandre@php.net
-  * Status: Draft+  * Status: Under Discussion
   * Implementation: https://github.com/php/php-src/pull/5962/files   * Implementation: https://github.com/php/php-src/pull/5962/files
   * First Published at: https://wiki.php.net/rfc/readline_interactive_shell_result_function   * First Published at: https://wiki.php.net/rfc/readline_interactive_shell_result_function
Line 9: Line 9:
 ===== Introduction ===== ===== Introduction =====
  
-Many other REPLs (Read-Eval-Print Loops) that I'm familiar with print a (possibly truncated) representation of the result of expressions, but PHP doesn't.+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. 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. 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) (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 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.
  
 ===== Proposal ===== ===== Proposal =====
Line 42: Line 45:
  * When $callback is null, removes the callback used to dump expression results.  * When $callback is null, removes the callback used to dump expression results.
  *  *
- * Currently, this always returns true, but future changes to the implementation may make it return false.+ * Currently, this always returns true, but future changes to the implementation 
 + may make it return false.
  */  */
 function readline_interactive_shell_result_function(?callable $callback): bool; function readline_interactive_shell_result_function(?callable $callback): bool;
Line 84: Line 88:
   * A parser may fail for code using new token types until the parser gets updated to handle the new token types. This stops being a concern after feature freezes. \\ Looping over ''@token_get_all()'' and bailing out on an unknown token type may help with that.   * A parser may fail for code using new token types until the parser gets updated to handle the new token types. This stops being a concern after feature freezes. \\ Looping over ''@token_get_all()'' and bailing out on an unknown token type may help with that.
   * How would crash/bug fixes of phpi or the parser be handled in patch releases of php if this was released with php?   * How would crash/bug fixes of phpi or the parser be handled in patch releases of php if this was released with php?
-  * Automatically rewriting the code to namespace the parser and its dependencies with ''\PHP\Internal\BundledPhpParser'' would let ''phpi'' be used with projects that depend on a different php-parser version. \\ (clarifications may be necessary to indicate to end users that the bundled parser copy won't get updates or support outside of php minor releases, +  * Automatically rewriting the code to namespace the parser and its dependencies with ''\PHP\Internal\BundledPhpParser'' would let ''phpi'' be used with projects that depend on a different php-parser version. \\ (clarifications may be necessary to indicate to end users that the bundled parser copy won't get updates or support outside of php minor releases, should not be used by libraries/applications and that it won't support newer php syntax, and possibly other things)
-should not be used by libraries/applications and that it won't support newer php syntax, and possibly other things)+
 </blockquote> </blockquote>
  
Line 95: Line 98:
  
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
 +
 +Voting starts on 2021-01-03 and ends 2021-01-17.
 +
 Yes/No, requiring 2/3 majority Yes/No, requiring 2/3 majority
  
Line 100: Line 106:
  
   * https://externals.io/message/111073 "Improving the usability of PHP's interactive shell? (completions, displaying expression results, custom syntax)"   * https://externals.io/message/111073 "Improving the usability of PHP's interactive shell? (completions, displaying expression results, custom syntax)"
 +  * https://wiki.php.net/rfc/readline_interactive_shell_result_function_straw_poll
rfc/readline_interactive_shell_result_function.txt · Last modified: 2021/02/03 00:39 by tandre