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

Is it intended to fully specify the shape of the names of node and slice types? #4

Open
frederick-vs-ja opened this issue Jun 14, 2024 · 3 comments

Comments

@frederick-vs-ja
Copy link
Contributor

Currently, the node and slice types are specified as class templates (or more precisely, class template specializations), namely basic_json_node, basic_json_slice, and basic_const_json_slice.

It's unclear to me whether it's better to specify the shape of these type names. As per [namespace.std]/2, this will implicitly allow specializing these class templates if they get standardized. However, it's unlikely to meaningfully specialize them without specializing the associated basic_json.

If we make slice and node nested types with unspecified/exposition-only names, the slice types can be just implemented as nested class template template <bool IsConst> class slice_ {/* ... */};, which seems far less complicated than the current strategy.

CC @YexuanXiao.

@YexuanXiao
Copy link
Owner

This was intentional. Based on my thinking at the time, most interfaces always use json_slice instead of json, so having a separate name is a more direct way. There is similar reason for not using template parameters to distinguish whether it’s const, and intentional to let users differentiate between these two templates.

@frederick-vs-ja
Copy link
Contributor Author

How about making slice and node types nested classes while providing convenient alias templates at the namespace scope?

@YexuanXiao
Copy link
Owner

How about making slice and node types nested classes while providing convenient alias templates at the namespace scope?

Sounds like there are no obstacles.

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