Open oepir opened 2 weeks ago
You actually need parenthesis after argv, like "sys.argv()[0]" because argv is a function. However, an error message should be displayed instead of crashing here.
You actually need parenthesis after argv, like "sys.argv()[0]" because argv is a function. However, an error message should be displayed instead of crashing here.
Yeah seems related to free functions imported from other modules somehow? If you define a local function and try this you get a reasonable error message.
Got it, thanks! However, it seems odd to me for a language that is aiming to be a superset of Python to deviate from the latter in such a subtle way -- https://docs.python.org/3/library/sys.html.
Got it, thanks! However, it seems odd to me for a language that is aiming to be a superset of Python to deviate from the latter in such a subtle way -- https://docs.python.org/3/library/sys.html.
This is likely just due to a technical limitation at the moment relating to file scope level expressions. I imagine in the future it'll match.
Yes, exactly!
Bug description
The mojo compiler crashed trying to parse
var prog = sys.argv[0]
.Steps to reproduce
Trying to compile the following program:
using
mojo build bug.mojo
leads to:
System information