Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

[BUG] REPL help example code fails to interpret #3336

Closed
shacron opened this issue Jul 30, 2024 · 2 comments
Closed

[BUG] REPL help example code fails to interpret #3336

shacron opened this issue Jul 30, 2024 · 2 comments
Assignees
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@shacron
Copy link

shacron commented Jul 30, 2024

Bug description

The example code given in the REPL help uses let, which causes it to fail. See :mojo help repl

Steps to reproduce

Welcome to Mojo! 🔥

Expressions are delimited by a blank line.
Type `:quit` to exit the REPL and `:mojo help` for further assistance.

  1> :mojo help repl 

The Mojo REPL (Read-Eval-Print-Loop) acts like an
interpreter of Mojo expressions, which are delimited by a
blank line. These expressions can define top-level
variables, functions, structs, and other declarations, which
are persisted across expressions. For example:

  1> let my_var = "Welcome to Mojo!"
  2.
  2> print(my_var)
  3.
  Welcome to Mojo!

Besides that, it is possible to execute Python expressions
using the %%python magic, which offers seamless interop with
Mojo code, including exposing top-level python declarations
in subsequent Mojo expressions. For example:

  1> %%python
  2> import sys
  3> print("Python version from python:", sys.version)
  4.
  Python version from python: 3.11.4

  5> print("Python version from Mojo:", sys.version)
  6.
  Python version from Mojo: 3.11.4

As the Mojo REPL is based on LLDB, the complete set of LLDB
debugging commands is also available as described below.

  Commands must be prefixed with a colon at the REPL prompt
  (:quit for example).
  Typing just a colon followed by return will switch to the
  LLDB prompt.

Type "< path" to read in code from a text file "path".

Finally, we encourage you to submit feature requests and error reports in
https://github.com/modularml/mojo/issues.
  1> let my_var = "Welcome to Mojo!" 
  2.  
[User] error: Expression [0]:1:1: use of unknown declaration 'let'
let my_var = "Welcome to Mojo!"
^~~

[User] error: Expression [0]:1:5: statements must start at the beginning of a line
let my_var = "Welcome to Mojo!"
    ^

expression failed to parse (no further compiler diagnostics)```

### System information

```shell
- What OS did you do install Mojo on ?
macOS Sonoma 14.6 (23G80)

- Provide version information for Mojo by pasting the output of `mojo -v`
mojo 24.4.0 (2cb57382)

- Provide Modular CLI version by pasting the output of `modular -v`
modular 0.9.1 (3460d12e)
@shacron shacron added bug Something isn't working mojo-repo Tag all issues with this label labels Jul 30, 2024
@soraros
Copy link
Contributor

soraros commented Jul 30, 2024

The let keyword is removed (please use var instead), it seems that we forgot to update the example.

@ematejska ematejska self-assigned this Aug 6, 2024
Copy link
Contributor

Thank you for reporting this! The fix is coming in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

4 participants