-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Namespace, scope and lazy loading #996
Comments
I made another test and found that it does the same with mixins-closures:
ends up as:
|
I can see why less does this.. when you write Ideally it should run it using first the namespace context and then if that fails, the current context. So I think it should be changed.. but it is a difficult one to gauge. See #297 |
I understand that scoping is difficult and I'm not demanding it to be fixed within 5 minutes :). Consistent handling of the scope is important: the more consistent it is, the easier it is to read less files. And if I do not fill an issue for a problem I know about, I'm sort of contributing to it. If mixin uses the scope of the namespace first, then the namespace can be used to encapsulate cooperating mixins. Then I can call mixin from the namespace and know what it will do. I do not have to worry about mixins in caller scope accidentally overriding namespace behavior. The namespace acts as a library. Plus, my opinion is that the scoping of namespaces should be the same as the scoping of mixins. Mixins without namespaces use their own scope before caller scope, so namespaces should too. The other issue #297 is interesting. If variables stay constants, then everything follows the same simple rule: define anywhere. Variables as real variables would complicate things, but maybe not by that much. The mixin or namespace could use variable value as it is at the declaration place. Regardless which way you will go, the important for me is to know what is the supposed behavior, what is a bug and whether there are plans to change it. I do not want to rely on something that will change. |
same with variables in #921 |
|
How is the namespace reference supposed to behave when the namespace is used before being declared? (Using mixins and variables before declaring them is legal.)
It seems like if I use mixin from namespace before declaring it, the mixin uses the caller mixins and variables scope. E.g. this:
compiles into:
The mixin test1 does not see other mixins declared in the same namespace. Is it a bug or was not supposed to use it this way?
If I put the first reference
#abc1 { #space1 > .test1(); }
after the#space
declaration, then the mixintest1
starts to compile correctly.The text was updated successfully, but these errors were encountered: