apple / pkl

A configuration as code language with rich validation and tooling.
https://pkl-lang.org
Apache License 2.0
9.85k stars 258 forks source link

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

Open moritztim opened 1 month ago

moritztim commented 1 month ago

Type parameters are only allowed in standard library

But why?

bioball commented 3 weeks ago

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.