Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prompt Incorrectly Reprinted for Incomplete S-Expressions in metta+> Interpreter #205

Closed
TeamSPoon opened this issue Dec 2, 2024 · 1 comment
Assignees
Labels
bug Issues that represent errors in the code Ready Mostly in complete state and waiting on a review process

Comments

@TeamSPoon
Copy link
Collaborator

When a user starts an S-expression (e.g., with an opening parenthesis () but does not complete it before pressing Enter, the metta+> interpreter incorrectly reprints the prompt on the next line. This behavior can mislead users into thinking the interpreter is ready for new input, even though it is still waiting for the completion of the S-expression.


Steps to Reproduce

  1. Start the metta+> interpreter.
  2. Enter the following input and press Enter:
    (
  3. Observe the behavior:
    • The interpreter reprints the metta+> prompt, even though it is still waiting for the user to complete the S-expression.
  4. Attempt to complete the S-expression, e.g.:
    (+ 1 1)
    • The interpreter processes the input correctly once the S-expression is completed.

Expected Behavior

  • When the user starts an incomplete S-expression and presses Enter:
    1. The interpreter should not reprint the metta+> prompt.
    2. Instead, the interpreter should clearly signal that it is waiting for further input to complete the S-expression (e.g., by not showing the prompt until the S-expression is finished).

Actual Behavior

  • The interpreter reprints the metta+> prompt on the next line after the user presses Enter, even though the input is incomplete.
  • This can mislead the user into thinking the interpreter is ready for new input when it is actually waiting for the S-expression to be completed.

Suggested Fix

  1. Hold Prompt Reprinting:
    • Detect when an input is incomplete (e.g., unmatched parentheses).
    • Do not reprint the metta+> prompt until the S-expression is fully completed.
  2. Optional Feedback:
    • Provide a subtle visual or textual indicator to show that the interpreter is waiting for additional input, such as:
      (incomplete)
      
      Or modify the prompt temporarily, e.g., metta+*>.
  3. Testing:
    • Add test cases to verify that the prompt is not prematurely reprinted for incomplete inputs.

Environment

  • Interpreter Version: [Insert version]
  • Operating System: [Insert OS and version]
  • Reproduction Rate: 100%

Additional Notes

Improving this behavior would enhance usability by making it clearer to users when the interpreter is still processing incomplete input. Holding back the prompt until the S-expression is finished would prevent confusion and improve the overall user experience.

TeamSPoon pushed a commit that referenced this issue Dec 11, 2024
switch prompts after the first line is read as per #205
@TeamSPoon TeamSPoon added bug Issues that represent errors in the code Ready Mostly in complete state and waiting on a review process and removed Implemented-AwaitsTest labels Dec 11, 2024
@TeamSPoon
Copy link
Collaborator Author

Ok Tested and it is doing hthe right things (i think!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that represent errors in the code Ready Mostly in complete state and waiting on a review process
Projects
None yet
Development

No branches or pull requests

2 participants