Replies: 2 comments
-
|
Hi there! If you using module amending, you do get the behavior you're looking for: Amending a module puts all types (classes and typealiases) defined in the parent (or any of its parents) in scope. Notably, properties and methods are treated differently and require explicit qualification with Also worth noting: import "module.pkl"
foo = new `module`.Initial { ... }Related topics have come up a few times in the past:
|
Beta Was this translation helpful? Give feedback.
-
|
Hello, thanks for your quick reply :) Amending is not quite the same, in my opinion, because it necessarily extends the module. However, one may not always want to do this. For example, one cannot define a new property, method, or class in the module because it would be unresolved: it cannot be found in the module being extended (in case of a property), or it would need to be declared Here, Instead, a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
As far as I understand from the documentation, a module prefix is required when importing, so all imported members must be accessed via their module name. While this ensures clarity, it introduces significant syntactic noise. Would it be possible to introduce a
from "..." import ...syntax to allow unqualified access to specific module members?So going from:
To:
My specific use case is a Pkl-based DSL where references to the module name are frequent.
Beta Was this translation helpful? Give feedback.
All reactions