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

Module name Experiment conflicts with common naming patterns #67

Open
joshavant opened this issue Jan 15, 2025 · 0 comments
Open

Module name Experiment conflicts with common naming patterns #67

joshavant opened this issue Jan 15, 2025 · 0 comments

Comments

@joshavant
Copy link

joshavant commented Jan 15, 2025

In our project, we'd like to use the symbol name Experiment (for a property wrapper, if you're wondering).

However, this project implements both:

  • The module name Experiment
  • The type name Experiment (e.g. this object)

This sufficiently confuses the Swift namespacing system, preventing all of your package users from being able to use the symbol Experiment in their own projects.

Example

If a user has implemented their own Experiment type AND wants to access your Experiment (even while explicitly referencing your module name), like so:

let foo = Experiment.Experiment.initializeWithAmplitudeAnalytics(apiKey:...

...the net result is that the Swift compiler will disambiguate this by preferring to search within the user-owned implementation, first, instead of this package's implementation.

That is, in the above example, the Swift compiler will look in the user's project (not your package) for:

struct Experiment {
    struct Experiment {
        func initializeWithAmplitudeAnalytics(apiKey:...) { }
   }
}

Request

This design choice prohibits your users from using a useful, common symbol name.

Please give us Experiment back. :)

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

No branches or pull requests

1 participant