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

Field internals such as FieldType should not be exported #387

Closed
prashantv opened this issue Mar 23, 2017 · 2 comments
Closed

Field internals such as FieldType should not be exported #387

prashantv opened this issue Mar 23, 2017 · 2 comments

Comments

@prashantv
Copy link
Collaborator

I think this changed as part of the zap/zapcore split, but the original plan with fields was to keep the implementation details completely private, and the only way to use a field would be to AddTo(Encoder).

It seems like FieldType is exported only to let the zap package expose field constructors, but I think what we should unexport all implementation details and instead:

  • Expose the same field constructors in the zapcore package
  • The zap package just wraps the underlying zapcore functions, and doesn't need access to the internals of a field.

This gives us more flexibility to change Field implementation details in future.

It's a little late for 1.0, but perhaps in a far away 2.0.

Thoughts? @akshayjshah @billf

@akshayjshah
Copy link
Contributor

I'll add this to a wishlist issue for a future major version release; we can discuss details then.

For the 1.0, I was weighing this implementation detail leak against the discoverability/documentation confusion cost of duplicating the field constructors. If we're going to keep fields completely opaque, we should just collapse everything back into one package - there are waaaaay too many field constructors (even for just the basic types) to make duplicating them worthwhile.

@akshayjshah
Copy link
Contributor

Moved to #388.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants