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

Replace ParameterType * TYPE * TYPE with named sort #273

Open
6 tasks
MeAmAnUsername opened this issue Mar 16, 2022 · 0 comments
Open
6 tasks

Replace ParameterType * TYPE * TYPE with named sort #273

MeAmAnUsername opened this issue Mar 16, 2022 · 0 comments
Labels
Component: code base The code quality of the project (does not affect functionality) Priority: low Status: proposal Enhancement in the proposal stage Type: enhancement New feature or request

Comments

@MeAmAnUsername
Copy link
Owner

Summary
Replace ParameterType * TYPE * TYPE with named sort to make function signatures more concise

Todo

  • Decide what sort to use
  • implement
    • change generic_params to list(TypeParameterType)
    • change getTypeParams to list(TypeParameterType)
    • change typeOfgenericParam to list(TypeParameterType)
    • change genericArgsOk to list(TypeParameterType)

Reason
ParameterType * TYPE * TYPE is used in a few places in the codebase, but it makes function and relation signatures which use it verbose. Replacing it with a specific sort would reduce clutter.

Description
ParameterType * TYPE * TYPE represents a type parameter and its upper and lowed bound.
It is used in a few functions in base.stx and type.stx, all related to the generic_params relation.
Making this change was attempted with the existing sort TypeParamType, but that failed because TypeParamType is a TYPEID * TYPE * TYPE, so it drops the scope from TypeParameter.

Implementation
Options:
1. Add upper and lower bound to TypeParameter directly. May not work, given that the generic_param relation uses generic parameters to look up the bounds, which suggests that the bounds are not always known when constructing a TypeParameter. If it does work, it means that the query for the lower and upper bound on a TypeParameter is no longer required though, which would be nice.
2. Check if the scope is required (maybe not, since the generic_params list is a list defined in the current scope. That makes it a bit harder to get the correct scope when the generic_params are obtained from a query though)
3. Create a new constructor, TypeParameterType: TypeParameter * TYPE * TYPE, or TypeParameterType: scope * TYPEID * TYPE * TYPE
4. Do not change current implementation (reject this issue)

Related issues
None

@MeAmAnUsername MeAmAnUsername added Type: enhancement New feature or request Status: proposal Enhancement in the proposal stage Component: code base The code quality of the project (does not affect functionality) Priority: low labels Mar 16, 2022
MeAmAnUsername added a commit that referenced this issue Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: code base The code quality of the project (does not affect functionality) Priority: low Status: proposal Enhancement in the proposal stage Type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant