mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
[Feature Request] Import deconstruction (& aliasing/macros) #280
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @joshqou on GitHub (Feb 19, 2025).
Deconstruction is a quality of life feature that a lot of languages have nowadays. Since Pkl lacks the ability to alias imported functions and structures, it results in a lot of repetitive
ProprietaryServiceConfig.ReusedClassThingor extending a class without adding anything so it can be referenced without explicitly specifying the module. This gets quite messy when different classes result in different output and the end-user file is expected to cast as one or another.An implementation would essentially let someone do an ES-like deconstructed import like this:
It would also be handy to be able to write aliases or macros within a pkl file, in a similar way to how typealiases currently work. I'm primarily interested in making it easier to repeatedly reference module exports but it could also be useful for other things as well.
@bioball commented on GitHub (Feb 21, 2025):
This feature makes sense to me.
Would like some feedback from the community to help us prioritize this.