Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certain function names are wrong in their error messages #305

Closed
rmolinari opened this issue Aug 9, 2024 · 3 comments
Closed

Certain function names are wrong in their error messages #305

rmolinari opened this issue Aug 9, 2024 · 3 comments

Comments

@rmolinari
Copy link
Contributor

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
Copy link
Owner

refaktor commented Aug 9, 2024

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
Copy link
Contributor Author

rmolinari commented Aug 10, 2024

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

rmolinari added a commit to rmolinari/rye that referenced this issue Aug 10, 2024
Some functions are named incorrectly in their own error messages.

Examples:
- split\every appears as "split-every" in its own error messages
  - most of the cases I found have this form: backslash appears as
    hyphen
- to-eyr and eyr\full both appear as "eyr"
  - this appears to be a copy/paste issue; there are some other
    occurrences
- near-zero appears as "is-zero"
  - perhaps an artifact of a renaming
  - this function's descriptive string was also wrong
refaktor added a commit that referenced this issue Aug 10, 2024
Address #305: function names in error messages
@refaktor
Copy link
Owner

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

cd tests
rye . test

rye . doc # creates the html docs out of tests 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants