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

Splitting source #132

Closed
dariomt opened this issue Oct 8, 2015 · 5 comments
Closed

Splitting source #132

dariomt opened this issue Oct 8, 2015 · 5 comments

Comments

@dariomt
Copy link
Contributor

dariomt commented Oct 8, 2015

Hi,
I appreciate the ease of deploying a single header file.
But, I think it would be better to decouple the different pieces of functionality.

I propose splitting the single json.hpp header file into three parts:

  • json_fwd.hpp with only the forward declarations of template basic_json and the alias json
  • json.hpp with the definition of template basic_json but without the io (and without the dependency to all the very heavy standard io related headers)
  • json_io.hpp with the definition of the io funcitonality, i.e. parsing, streaming, etc...

Do you think this is feasible?

@nlohmann
Copy link
Owner

I don't think splitting is a good idea, because it makes using the code harder. Furthermore, it is hard to draw a line between "core functionality" and io, because implicit conversions and operator overloading are hard to classify.

@dariomt
Copy link
Contributor Author

dariomt commented Oct 13, 2015

OK, understood.
Would you consider adding just the header with the forward declarations?
It makes it easier to write code that depends only on the declaration of basic_json.

@nlohmann
Copy link
Owner

nlohmann commented Dec 6, 2015

Is there a way to create such a header automatically? I would like to avoid a manual step every time something is changed.

@dariomt
Copy link
Contributor Author

dariomt commented Dec 9, 2015

I don't think so.
Forward declarations have to be manually synchronized with the definitions.

@nlohmann
Copy link
Owner

nlohmann commented Dec 9, 2015

I also thought so. I am currently not planning to distribute the code over several files. The 1-file solution is a feature I would like to keep.

@nlohmann nlohmann closed this as completed Dec 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants