quint
quint copied to clipboard
redefining a function gives a "syntax error"
In the repl,
>>> def farenheit(celsius) = celsius * 9 / 5 + 32
>>> def farenheit(celsius) = celsius * 9 / 5 + 32
syntax error: <input>:4:1 - error: Conflicting definitions found for name farenheit in module __REPL
4: def farenheit(celsius) = celsius * 9 / 5 + 32
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<input>:5:1 - error: Conflicting definitions found for name farenheit in module __REPL
5: def farenheit(celsius) = celsius * 9 / 5 + 32
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I get a syntax error, even though my syntax is fine. The error message is super useful; I would just put it in a category other than "syntax".
We have discussed the need to allow some form of redefinition or shadowing int he REPL tho. I think it's agreed we need it :)
That said, conflicting definitions in a language that doesn't support shadowing does seem like a syntax error to me. What category would make more sense do you think?
If we agree that "syntax error" means "cannot be parsed"/"cannot be generated by grammar", then this would not be a syntax error. Assuming you want to disallow redefinitions (i.e. not in a REPL), then this error would be caught at some point during semantic analysis, and so any sub-category of "semantic error" would make sense to me.
We have discussed the need to allow some for of redefinition or shadowing int he REPL tho. I think it's agreed we need it :)
That would indeed be great!
Ah I see. Yeah, that makes sense to me.