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

Type-safe Validation of Standard Constraints #77

Open
1 task done
PSchmiedmayer opened this issue Jul 31, 2023 · 0 comments
Open
1 task done

Type-safe Validation of Standard Constraints #77

PSchmiedmayer opened this issue Jul 31, 2023 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@PSchmiedmayer
Copy link
Member

PSchmiedmayer commented Jul 31, 2023

Problem

Currently, there is no compile-time validation of the enforcement of constraints to the Standard in the configuration. E.g., the following code would compile even though the ExampleStandard does not conform to ExampleConstraint:

protocol ExampleConstraint: Standard {
    // ...
}

class ExampleComponent: Component {
    @StandardActor var standard: any ExampleConstraint
   
    // ...
}

actor ExampleStandard: Standard {
    // ...
}

var configuration: Configuration {
    Configuration(standard: ExampleStandard()) {
        ExampleComponent()
        // ...
    }
}

Solution

The compiler should emit a warning that the ExampleStandard does not conform to ExampleConstraint when defining it in the Configuration.

Unfortunately, this doesn't seem to be easily achievable in Swift and needs some further investigation.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct and Contributing Guidelines
@PSchmiedmayer PSchmiedmayer added enhancement New feature or request help wanted Extra attention is needed labels Jul 31, 2023
@PSchmiedmayer PSchmiedmayer moved this to Backlog in Project Planning Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Status: Backlog
Development

No branches or pull requests

1 participant