-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context/Scope of vars not working when schema/mixin imported from module #1777
Comments
Even if I define the
|
@Peefy can you confirm, that my observation makes sense to you...? I also tried to find the place in the code, where I can start to fix it by myself... (resolving this would greatly improve our kcl code) |
It seems that you have some misunderstanding about the use of mixin and protocol We have an example about Protocol and Mixin: https://www.kcl-lang.io/docs/next/reference/lang/tour#advanced For your case, you can implement it with the following code
|
Thanks @He1pa for the example, and I can follow it, but (and I should have copied the working example into this ticket to outline my amazement)... I am still wondering if this is a bug or a feature, since it is working without explicitly introducing
resulting in
So the bug I was assuming I have found, was, that when moving the definition of My explanation that this works is, that |
This is an undesigned situation. We never considered that Protocol appears as an attribute in attr. like
Protocol is some assembly logic of Mixin. And Mixin is used in the way of |
@He1pa this protocol feature is only a "byproduct" of my issue... sorry The main topic/question is: why is the example working, when everything (mainly I have created a repo for this issue, so you can just check it out and test easily the difference - since I have the impression, that my issue is not really understood. I have also removed the usage of protocol-as-a-schema: https://github.com/bettermarks/kcl-issue-1777 So the issue is about the import of the mixin and why does it break. |
ok, I will check again |
Bug Report
I am very confused, how the scope/context is applied resp. how
_default_config
is resolved.My naive understanding was (before I moved the definitions to the module) that the scope/context is created at "init-time" and is somehow passed/"shining" from module level through the deeper schema tree... but now this issue confuses my a lot...
1. Minimal reproduce step (Required)
If I move schema/mixin/protocol definitions to a module a context var is not found: the working example is here
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your KCL components version? (Required)
The text was updated successfully, but these errors were encountered: