apple / pkl

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

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

Open moritztim opened 6 months ago

moritztim commented 6 months ago

Type parameters are only allowed in standard library

But why?

bioball commented 5 months 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.