Skip to content

Provide better typed json_typeof#701

Open
dwt wants to merge 1 commit intoakheron:masterfrom
dwt:patch-1
Open

Provide better typed json_typeof#701
dwt wants to merge 1 commit intoakheron:masterfrom
dwt:patch-1

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