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

[Feature Request] REPL should print return values #3188

Closed
1 task done
GTP95 opened this issue Jul 7, 2024 · 1 comment
Closed
1 task done

[Feature Request] REPL should print return values #3188

GTP95 opened this issue Jul 7, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request mojo-repo Tag all issues with this label

Comments

@GTP95
Copy link

GTP95 commented Jul 7, 2024

Review Mojo's priorities

What is your request?

I think that the REPL should print the return values of functions automatically, similarly to what the Python interpreter does. Currently, I have to wrap function invocations in a print() to be able to see the result.

What is your motivation for this change?

I was trying the examples provided here inside the REPL, but the following two functions confused me:

def greet(name):
    return "Hello, "   name   "!"
fn greet2(name: String) -> String:
    return "Hello, "   name   "!"

In the first case, invoking the function from the REPL gives no output and in the second case I got a warning. Initially, I wondered if there was anything wrong with my installation, but then I figured out that I needed to wrap the invocation inside a call to print, like this: print(greet("Mario")). Usually, REPLs don't require explicitly calling print() to see a function's output, and I think Mojo's REPL should have the same behavior.

Any other details?

No response

@GTP95 GTP95 added enhancement New feature or request mojo-repo Tag all issues with this label labels Jul 7, 2024
@walter-erquinigo
Copy link
Contributor

Thank you, this is already in our roadmap for later this year. We'll keep you posted.

@linear linear bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 9, 2024
@walter-erquinigo walter-erquinigo self-assigned this Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

2 participants