-
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
Global mixins and mixins inside namespaces handle scopes differently #1316
Comments
More over if you remove I was recently trying to make a sort of graphical cheat sheet for LESS 'scope precedence' (because sometimes it may be really complicated to retain which one overrides which other). Well, I did not finish it (because I did not manage to find a satisfactory visual representation - yet I hope), but here's at least a basic crib that covers most of typical scenarios, it's actually a two because parametric and non-parametric parent mixins (aka namespaces) result in a different precedence:
The code template I used (to illustrate what all those local/callee/parent/global/caller refer to):
p.s. edit: fixed parametric vs. non-parametric precedence sheet (accidentally swapped). |
Another curiouse example inspired by #2212 (comment):
Now thinking of it in context of #2212 (comment) it becomes to look even more tricky: the problem is that |
Scoping of global mixins is handled differently then scoping of mixin inside namespaces:
Should they behave differently? If no, which version is correct?
Direct mixin call - mixin searches definition space first. It will never hit the caller:
compiles into:
If I place exactly the same mixin into a namespace, output changes:
compiles into:
The same effect happens with variables and mixins defined in namespace itself:
compiles into:
Tested on 1.4.0-beta-b4 with windows node.js.
The text was updated successfully, but these errors were encountered: