elm / error-message-catalog

A catalog of broken Elm programs / data to improve error messages
BSD 3-Clause "New" or "Revised" License
173 stars 17 forks source link

Hint that exponentiation is ^ when wrongly using undefined ** #193

Closed drathier closed 6 years ago

drathier commented 7 years ago

When trying to use ** for exponentiation (10**24, as used in Python) the error message says that the variable ** is not defined. In this case, it would be helpful if the compiler asked Did you mean exponentiation? (10^24)

If you did define ** yourself, this hint wouldn't show, since it's no longer an undefined variable error.

evancz commented 6 years ago

Made some changes a moment ago. The error should be like this in the next release:

-- UNKNOWN OPERATOR -------------------------------------------------------- temp.elm

I do not recognize this (**) operator:

3|   10 ** 24
        ^^
Switch to (^) for exponentiation. Or switch to (*) for multiplication.

Thanks for mentioning this! Easy to improve, and will definitely help some newcomers out!