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

Provide better typed json_typeof #701

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Provide better typed json_typeof #701

wants to merge 1 commit into from

Conversation

dwt
Copy link

@dwt dwt commented Oct 31, 2024

Further down in the header the function json_error_code() is defined to return the enum json_error_code.

That function has a much better documentation value, as it also defines what values the returned value can have.

It also sets a naming precedent, of having a function of the same name as the enum, which makes a lot of sense to me.

In the future, when you bump the major version of the library anyway, you could change the define of json_typeof to

#define json_typeof json_type

and maybe start a deprecation cycle of the old name.

What do you think? Would that be a good patch?

Further down in the header the function `json_error_code()` is defined
to return the `enum json_error_code`.

That function has a much better documentation value, as it also defines
what values the returned value can have.

It also sets a naming precedent, of having a function of the same name
as the enum, which makes a lot of sense to me.

In the future, when you bump the major version of the library anyway,
you could change the define of json_typeof to

`#define json_typeof json_type`

and maybe start a deprecation cycle of the old name.
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

Successfully merging this pull request may close these issues.

1 participant