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

[Feature Request] User-defined generics (type parameters for classes) #494

Open
moritz-t-w opened this issue May 15, 2024 · 1 comment
Open

Comments

@moritz-t-w
Copy link

Type parameters are only allowed in standard library

But why?

moritz-t-w added a commit to moritz-t-w/GitHub-Forms-PKL that referenced this issue May 16, 2024
@bioball
Copy link
Contributor

bioball commented Jun 10, 2024

Generics add a lot of complexity to the language, and is hard to get right. This is something we would like to add to the language at some point, but I would say that we're not close yet.

For example, one thing to consider is how to implement variance checking. Today, Pkl does not perform subtype checking, and this is not trivial because of type constraints.

We also have some bugs with type parameters in the core language that will need to be fixed before we can start to consider something like this.

@bioball bioball changed the title [Feature Request] Type parameters for Classes [Feature Request] User-defined generics (type parameters for classes) Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants