-
Notifications
You must be signed in to change notification settings - Fork 463
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
Unable to append variable-length parameters after optional parameter #980
Comments
I guess this has changed in ruby sass without us noticing. I just had to remove the existing check and everything seems to work correctly (#981). I took the liberty to adjust the test case from @davidkpiano above and I hope someone would volunteer to create a PR on sass-specs for this, thanks! |
We need to be careful here. Optional and variable-length parameters can be mixed, but only in specific orders i.e. variable-parameters can follow optional parameters but not the other way around. |
@xzyfer Why not ? I understand that when passed inline we cannot split optional parameters from variable-parameters, but it would work well with named parameters, and would be really useful to provide additional "second-hand" options to a function. For example: @function please-call-this-for-me($func, $args..., $warn: true) {
@if type-of($func) == 'function' and function-exists($func) {
@return call($func, $args...);
}
@else if $warn == true {
@warn 'Function #{$func} does not exists';
}
}
// Call "foo" with (bar, baz, warn)
$_: please-call-this-for-me(foo, bar, baz, warn);
// Call "foo" with (bar, baz)
$_: please-call-this-for-me(foo, bar, baz, $warn: false); That's a stupid example I know, but we can see that the "main job" of What do you think ? |
A function that is called with an optional parameter followed by a variable-length parameter throws the error
"Optional parameters may not be combined with variable-length parameters"
despite being valid in Ruby Sass.The text was updated successfully, but these errors were encountered: