-
Notifications
You must be signed in to change notification settings - Fork 55
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
More flexible typing for service objects #609
Comments
Update: Currently, developers use compiler plugins to perform this validation. The practice involves defining distinct service object types (usually empty or containing the required remote functions). Compiler plugins then validate the service declarations based on these types. Specifically, service declarations with listener attachments are validated by deriving the service type from the listener's attached method. Recently, we discussed whether we could enhance service type support to better meet current requirements.
While working on these improvements, we identified areas where type-checking is currently loosely enforced. For example:
The primary use case for these enhancements is to streamline compiler plugin validation and enable the library itself to provide the necessary details. This would better support developer tools such as Language Servers (LS) and low-code views. |
For Listeners such as HTTP and GraphQL, the type of the resource and remote methods is used to express how the application constrains the use of the protocol. The Listener uses the type of the resource and remote methods to validate whether incoming requests satisfy these constraints and to map from protocol-defined datatypes onto application-defined datatypes.
The service object type needs to be able to describe the possible types that the Listener supports. For example, a Listener might support any type that is a subtype of
anydata
. Because of contravariance of parameter types, it would not be correct for the service object type to specify the parameter type asanydata
. We need additional typing flexibility to be able to describe this.The text was updated successfully, but these errors were encountered: