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

How to represent type errors when _or_ is involved? #32

Open
shaleh opened this issue Oct 12, 2023 · 1 comment
Open

How to represent type errors when _or_ is involved? #32

shaleh opened this issue Oct 12, 2023 · 1 comment

Comments

@shaleh
Copy link

shaleh commented Oct 12, 2023

I see there is a TypeError defined in core/error.rs. However, the Emacs C code often has something like:

return wrong_type_argument (Qchar_or_string_p, obj);

Does that mean the Type enum needs to learn about "CharOrString" and all the other permutations of this?
I bumped into this while exploring what it would take to implement downcase.

@CeleritasCelery
Copy link
Owner

The Error handling needs to be reworked to align with Emacs. Emacs' errors are conses that have an error symbol followed by additional information. The errors in Rune are just anyhow::Error's that are basically a catch all for any type. Part of that is I didn't really understand how errors were structured when I started this.

(condition-case x
    (downcase '(1))
  (wrong-type-argument (setq my-error x)))
(consp my-error)

Basically we need a new error type that is more structured and follows the convention of Emacs. In the meantime you are correct, we can add a CharOrString type to the Type enum.

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