refaktor / rye

homoiconic dynamic programming language with some new ideas
https://ryelang.org
Apache License 2.0
406 stars 21 forks source link

Certain function names are wrong in their error messages #305

Closed rmolinari closed 1 month ago

rmolinari commented 1 month ago

Some function names of the form foo\bar appear as foo-bar in their own error messages.

For example:

x> split\every 2 2
Failure
Error: Function split-every requires argument 1 to be of        : String, Block. 
At location:
{ split\every 2 (here) 2 }

Note that the function is called "split-every" in the error message instead of "split\every". There are some other such cases in evaldo/builtins.go.

I have a fix for at least some of these in my fork and am happy to create a pull request. This issue is, in part, to satisfy the request in CONTRIBUTIONS.md to create an issue before the PR.

Q: how do I run all the tests to make sure I haven't broken anything?

refaktor commented 1 month ago

Thank you. Yes ... I imagine that is a not so uncommon bug in our current codebase. Currently, the design is such, as we don't want functions to hold another value (it's name) at runtime in hope to be as lightweight as possible (because everything is function in Rye, also all that are usually language specific constructs (if/for/fn/..). We will start profiling current implementation at some point and if it shows that this is not needed it will be changed to form that will be easier to be consistent. Or we would make a tool that checks this.

We will see ... for now, there is only a manual method so PR with these fixes is more than welcome!

rmolinari commented 1 month ago

I'll create a PR.

~Separately: how can I run the tests locally, to make sure I didn't break anything?~

I found the instructions in the README

refaktor commented 1 month ago

Testing script will get improved. Currently you can run it with:

cd tests
rye . test

rye . doc # creates the html docs out of tests