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

json2.decoder2: prepare decoder in json2 to be replaced by json2.decode2 #23078

Merged
merged 7 commits into from
Dec 6, 2024

Conversation

enghitalo
Copy link
Contributor

@enghitalo enghitalo commented Dec 6, 2024

@spytheman
Copy link
Member

spytheman commented Dec 6, 2024

No, deprecations of public functions take time. Add at least 1 month starting from today.
See https://docs.vlang.io/attributes.html, search for the section Function/method deprecations .

Alternatively, just do not deprecate the method, and leave it as it is, including its tests.

@enghitalo
Copy link
Contributor Author

No, deprecations of public functions take time. Add at least 1 month starting from today.
See https://docs.vlang.io/attributes.html, search for the section Function/method deprecations .

Alternatively, just do not deprecate the method, and leave it as it is, including its tests.

I prefer to make them deprecated. When x.json2 becomes just json, probably none of these methods will be part of the library. I hope

@spytheman
Copy link
Member

They are public API, public APIs should have a deprecation period. It is very rude to users of your libraries, to make breaking changes like this, especially if you have an easy way to avoid it.

@spytheman spytheman closed this Dec 6, 2024
@enghitalo enghitalo reopened this Dec 6, 2024
@huly-for-github huly-for-github bot closed this Dec 6, 2024
@huly-for-github huly-for-github bot reopened this Dec 6, 2024
res := raw_decode(src)!.as_map()
return decode_struct[T](T{}, res)
}

// decode_array is a generic function that decodes a JSON string into the array target type.
pub fn decode_array[T](src string) ![]T {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spytheman spytheman merged commit de3b184 into vlang:master Dec 6, 2024
62 checks passed
@enghitalo enghitalo deleted the decoder/replace branch December 6, 2024 17:53
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.

2 participants