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

Make types public #1180

Closed
wants to merge 8 commits into from
Closed

Make types public #1180

wants to merge 8 commits into from

Conversation

tusharmath
Copy link

@tusharmath tusharmath commented Aug 2, 2023

Types can be used to generate a RootNode dynamically. This is a quick fix for #1117.
if this looks good, I can create a few more PRs that make some of the internal types public, allows developers to create RootNode and Schema using techniques other than Macros.

@tusharmath tusharmath changed the title Update lib.rs Make types public Aug 2, 2023
@tusharmath tusharmath marked this pull request as draft August 2, 2023 06:39
@LegNeato LegNeato marked this pull request as ready for review August 24, 2023 22:42
@LegNeato LegNeato self-requested a review August 24, 2023 22:43
Copy link
Member

@LegNeato LegNeato left a comment

Choose a reason for hiding this comment

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

Can you add an integration test to make sure we don't break this in the future? Can you also add to the docs that these public types are experimental and not to be relied on, linking back to the issue? Thanks!

@tyranron
Copy link
Member

@LegNeato I'll look at this next week.

Copy link
Member

@tyranron tyranron left a comment

Choose a reason for hiding this comment

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

@tusharmath the proposed changes are quite controversial. Overall, I'm not a fan of them.

Could you show a code that requires these changes to achieve what you want? Having it, it would be better to come up with the solution that satisfies both of us.

@@ -6,7 +6,7 @@ use std::{
};

#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Name(String);
Copy link
Member

Choose a reason for hiding this comment

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

@tusharmath I don't like this change, because it breaks encapsulation for the Name type here and allow freely bypass its invariants. It's far better here to provide a meaningful constructor-function, which checks the invariants.

@@ -33,8 +33,8 @@ mod ast;
pub mod executor;
mod introspection;
pub mod parser;
pub(crate) mod schema;
mod types;
Copy link
Member

Choose a reason for hiding this comment

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

@tusharmath here types are mostly re-exported to the crate's root. If something is missing, I think it's better to add that to the re-exports, rather than making these modules public.

@tyranron tyranron added enhancement Improvement of existing features or bugfix k::api Related to API (application interface) labels Nov 2, 2023
@LegNeato
Copy link
Member

I'm going to close this out. Feel free to comment if you want it reopened to continue discussion!

@LegNeato LegNeato closed this Oct 25, 2024
@tyranron tyranron added wontfix This will not be worked on obsolete This issue is not relevant anymore labels Oct 28, 2024
@tyranron tyranron added this to the 0.17.0 milestone Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing features or bugfix k::api Related to API (application interface) obsolete This issue is not relevant anymore wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants