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

css_for_theme_with_class_style is fallible but can never error #468

Open
SabrinaJewson opened this issue Apr 8, 2023 · 2 comments
Open

Comments

@SabrinaJewson
Copy link

In #432, the function was made fallible, but it can never return an error. Is this intentional? It was not mentioned in the PR.

@Enselic
Copy link
Collaborator

Enselic commented Apr 8, 2023

Even if it currently never errors, the API change in the PR made it possible to introduce an error without breaking API compatibility. So it was a matter of future-proofing the API.

(At least that is what I assume. I have not double-checked the details.)

@SabrinaJewson
Copy link
Author

Even if it currently never errors, the API change in the PR made it possible to introduce an error without breaking API compatibility. So it was a matter of future-proofing the API.

It’s not quite so simple. If you give the guarantee that the function never errors currently, even without changing the signature changing the behaviour of the function is still a way to break API compatibility. Suppose I .unwrap() the result of the function when I call it. This means either

  1. I am relying on unstable behaviour that it won’t ever error, or
  2. it is correct, and syntect actually gives the guarantee it won’t ever error, in which case the function signature is wrong.

In the docs, syntect doesn’t say anything about under what conditions the function is allowed to error; this means the documentation is underspecified, so this issue should still stay open.

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