Replace ParameterType * TYPE * TYPE with named sort #273
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
Summary
Replace
ParameterType * TYPE * TYPE
with named sort to make function signatures more conciseTodo
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
andtype.stx
, all related to thegeneric_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 fromTypeParameter
.Implementation
Options:
1. Add upper and lower bound to
TypeParameter
directly. May not work, given that thegeneric_param
relation uses generic parameters to look up the bounds, which suggests that the bounds are not always known when constructing aTypeParameter
. 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 thegeneric_params
are obtained from a query though)3. Create a new constructor,
TypeParameterType: TypeParameter * TYPE * TYPE
, orTypeParameterType: scope * TYPEID * TYPE * TYPE
4. Do not change current implementation (reject this issue)
Related issues
None
The text was updated successfully, but these errors were encountered: