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

Encapsulation design #93

Open
Peanuuutz opened this issue Jan 12, 2022 Discussed in #92 · 2 comments
Open

Encapsulation design #93

Peanuuutz opened this issue Jan 12, 2022 Discussed in #92 · 2 comments
Assignees

Comments

@Peanuuutz
Copy link
Contributor

Discussed in #92

Originally posted by Peanuuutz January 12, 2022
Currently encapsulation is not present, which is an urgent problem for a widely used application. We should only expose those classes and functions that are necessary for users. This will help users to quickly find what they want, as well as help us develop new features as well as modify existing code without worrying about breaking users' applications.

I'm going to copy what I have done. (Actually these are quite common)

The following are public:

  • Entrypoint for serialization and deserialization: Toml. (Consider this suggestion)
  • AST: TomlValue(which derives TomlBoolean, TomlLong, TomlBasicString, TomlArray, TomlTable to name a few).
  • AST manipulation: like JsonPrimitive.int.
  • Exceptions: only sealed TomlEncodingException and TomlDecodingException.

The following are internal:

  • Encoders
  • Emitters
  • Decoders
  • Parsers

Also, I suggest separating AST itself and the actual parsing process, like Toml<type> only has content property, while Toml<type>Parser is responsible for parsing and producing it.

@Peanuuutz Peanuuutz reopened this Jan 12, 2022
@Peanuuutz
Copy link
Contributor Author

Sync the answer.

New question raised.

@orchestr7
Copy link
Owner

Sync the answer.

New question raised.

Yes, let it be open. At least we will mark internal methods with opt-in and revise private methods

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