witheve / Eve

Better tools for thought
http://witheve.com
Apache License 2.0
7.17k stars 257 forks source link

Incorrect function syntax could have more friendly error message #436

Open frankier opened 8 years ago

frankier commented 8 years ago

I believe a common mistake for people coming with some programming experience in other languages might be trying to call a function with positional arguments. So eg if I call call a function like so sgn_x = new_x / abs[new_x] I will get an error like:

Unknown expression
(passed string)
Unknown expression "abs"

54|  sgn_x = new_x / abs[new_x]
                    ^
Did you mean: "abs"?

I think in this particular case the error should instead mention the parameter needs to be given a name and possible offer a fixit at least for single parameter built-ins where the intention should be easily guessable.

joshuafcole commented 8 years ago

Agreed! We have all the information required, but not a lot of love has been put into the errors yet. I'll make sure this happens before the next release.