You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.ReusedClassThing or 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:
// Provides `convertToHCL` and `Terraform`import"/path/to/file.pkl"as { convertToHCL, Terraform }
// Provides `Terraform`, and the module as `file`import"/path/to/file.pkl"asfile, { Terraform }
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.
import"/path/to/file.pkl"
alias convertToHCL = file.convertToHCL
output {
value = convertToHCL(someKey)
}
The text was updated successfully, but these errors were encountered:
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.ReusedClassThing
or 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.
The text was updated successfully, but these errors were encountered: