Skip to content

Module name Experiment conflicts with common naming patterns #67

@joshavant

Description

@joshavant

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. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions