Skip to content

Detached rulesets do not return variables #2083

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

Closed
SomMeri opened this issue Jul 1, 2014 · 2 comments
Closed

Detached rulesets do not return variables #2083

SomMeri opened this issue Jul 1, 2014 · 2 comments

Comments

@SomMeri
Copy link
Member

SomMeri commented Jul 1, 2014

Now I see that detached rulesets do not return variables at all. Following throws compile error:

@detached-ruleset: { 
    @color:blue; //variable NOT returned
};
.caller {
    @detached-ruleset();
    color: @color; 
}

Error:

NameError: variable @color is undefined in C:\data\meri\less4java\commandLineLess\node.js-latest\test.less on line 6, column 12:
5     @detached-ruleset();
6     color: @color;
7 }

Is that how it should be? Mixins are returned as usually. If this is as expected, then the #2064 should be closed too.

Tested on lessc 1.7.3 (Less Compiler) [JavaScript]

SomMeri pushed a commit to SomMeri/less4j that referenced this issue Jul 1, 2014
@seven-phases-max
Copy link
Member

Yes, this is what we actually assumed in #2064 (i.e. there it was not some kind of a scope priority issue but just "DR does not expose its variables to outer scope at all"). Hmm, I guess we can close #2064 and keep the discussion here?

@SomMeri
Copy link
Member Author

SomMeri commented Jul 1, 2014

I closed the other issue and I am closing this one too. I did not liked the subtle difference in behavior I through I found, but this is not subtle at all. After all, workaround is possible, although somewhat limited:

@detached-ruleset: { 
  .acquire() {
    @color:blue; //variable will be returned
  }
};
.caller {
    @detached-ruleset();
    .acquire();
    color: @color; 
}

Might make sense to re-open if someone has real use case for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants