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

Config options should not affect the public API #2509

Closed
MabezDev opened this issue Nov 8, 2024 · 4 comments · Fixed by #2945
Closed

Config options should not affect the public API #2509

MabezDev opened this issue Nov 8, 2024 · 4 comments · Fixed by #2945
Assignees
Labels
beta-blocker package:esp-config Issues related to the esp-config package
Milestone

Comments

@MabezDev
Copy link
Member

MabezDev commented Nov 8, 2024

Continuing the discussion from #2422 (comment)

We need to answer this question and then write the appropriate API-GUIDELINES to avoid violating this decision.

@MabezDev MabezDev added RFC Request for comment package:esp-config Issues related to the esp-config package labels Nov 8, 2024
@github-project-automation github-project-automation bot moved this to Todo in esp-rs Nov 8, 2024
@bjoernQ
Copy link
Contributor

bjoernQ commented Dec 4, 2024

My gut feeling is it shouldn't and only features should affect the public API - I don't have a great reasoning for that, but it doesn't feel right to change the API based on a configuration option

Technically the difference is "just" that other crates can activate a feature while only the binary-crate can set a config option

The linked comment however is a very interesting case:
Enabling CSI increases memory (and CPU?) usage but also we shouldn't allow users to call the related functionality if CSI is not enabled. If we cfg-away the API for that if it's not enabled, we are in fact changing the public API and make things fail at compile time - otherwise we would offer the API but return errors (preferred) or panic if CSI is not enabled

@tom-borcin tom-borcin added the investigation Not needed for 1.0, but don't know if we can support without breaking the driver. label Dec 16, 2024
@MabezDev
Copy link
Member Author

MabezDev commented Jan 9, 2025

I agree, config options shouldn't affect the public API, I think we're better off adding those sorts of changes as features. We previously weren't keen on doing so because of the number of features we already had 😅, but we've reduced the number massively in recent months.

To action this change we need to:

  • Remove the CSI config, and add it back as a feature
  • Update the API-docs
  • Look for any other configs that change the API (A quick skim and I think it's just CSI, but better to do a full check)

@MabezDev MabezDev added beta-blocker and removed RFC Request for comment investigation Not needed for 1.0, but don't know if we can support without breaking the driver. 1.0-blocker labels Jan 9, 2025
@MabezDev MabezDev added this to the 1.0.0-beta.0 milestone Jan 9, 2025
@MabezDev MabezDev changed the title [RFC] Should config options affect the public API? Config options should not affect the public API Jan 9, 2025
@bugadani
Copy link
Contributor

bugadani commented Jan 9, 2025

Look for any other configs that change the API

Well I guess it's better if I respect this in the embassy-time PR 🥲

@Dominaezzz
Copy link
Collaborator

embassy-time is an interesting case since that's almost exclusively setup by the application rather than a library.

I say "almost" because frameworks are a thing, a library could be providing some kind of fn main() that sets up embassy time for ya.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-blocker package:esp-config Issues related to the esp-config package
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants