ProtixIT / dataclass-binder

Python library to bind TOML data to dataclasses in a type-safe way
MIT License
13 stars 2 forks source link

Add support for generic dataclasses #1

Open mthuurne opened 1 year ago

mthuurne commented 1 year ago

A dataclass could be a generic class and a specialized version of it could be used as a field type.

There is no theoretical reason to not support this, but in practice it turns out to be rather tricky to properly support, in terms of the amount of code and tests required. The problem being that we'd have to substitute type arguments properly, including across base classes and collection types (like Iterable[T] where we'd have to substitute str for T).

I haven't run into a scenario yet where this feature is needed, so for now it has low priority.