Currently, any manipulation of functiontype results in the loss of parameter names. The API provides access exclusively to argument types, but not to their identifiers
The parameters() method returns only the type structure:
functiontype:parameters(): { head: {type}?, tail: type? }
As shown, only the parameter types (head and tail) are accessible, while their string names are not. A similar situation occurs with the setparameters and newfunction methods:
functiontype:setparameters(head: {type}?, tail: type?)
types.newfunction(
parameters: { head: {type}?, tail: type? },
returns: { head: {type}?, tail: type? }?,
generics: {type}?
): type
I propose extending the parameter data structure to allow passing and retrieving the parameter name as a string singleton alongside its type