Skip to content

[Proposal] Optional explicit type parameters #39

@gregsn

Description

@gregsn

We want the user to be able to specify explicit type parameters on type definitions.
This is necessary to solve Issue B mentioned here: #38

In the Name field
you shall be able to write MyClass<MyT1, MyT2>.

By that, you tell the system

  • there are exactly two type parameters in this generic type
  • these are their names - inside my type definition we can refer to those types inside of type annotations
  • and this is the order. If a user of our type has some type annotation MyClass<Float32, Boolean> somewhere, it is clear which type parameter is replaced by which type argument.

This proposal tries to not reinvent everything:

  • This way of expression is optional. Generic type definitions without explicit type parameters are still valid.
  • However, type annotations referring to generic types shall only be valid if
    • the type definition has explicit type parameters or
    • the type definition ended up with only one type parameter

This proposal is not about optional explicit type parameters on

  • instance operation definitions
  • static operation definitions

For now, we want to tackle the problems on type definitions. Let's see if we then still need those other forms of expression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions