Skip to content
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

Spread feature to complement rest argument feature #2614

Closed
StreetStrider opened this issue Jun 19, 2015 · 3 comments
Closed

Spread feature to complement rest argument feature #2614

StreetStrider opened this issue Jun 19, 2015 · 3 comments

Comments

@StreetStrider
Copy link

Hello. I've found @rest... feature which allows to capture variadic arguments in a list. So I've tried to use it, but faced issue when I need to pass my variadic arguments to another mixin. Here's synthetic example:

.x(@a; @b)
{
  a: @a;
  b: @b;
}
.x(wow; @rest...) // special form of `.x`
{
  c: something-special;
  .x(...@rest); // <- spread required here
}
a
{
  .x(wow; 1; 2);
}

So, in special form I capture all arguments and pass it to common form.

The only workaround for now is to pass all arguments manually. But this case becomes ugly when number of arguments grows and/or they obtain default values. So I need to take into account all defaults: extract them in variables and set they as defaults in both forms of mixin. rest feature is good, but it isn't complete without ability to spread captured list to another mixin. Thanks.

@seven-phases-max
Copy link
Member

See #1857 (don't forget to put another +1 there).

@seven-phases-max
Copy link
Member

Closing as duplicate of already implemented (but not merged) #1857.

@StreetStrider
Copy link
Author

@seven-phases-max, thanks for heads up. And please sorry for dup, I've looked through issues by «spread» and «rest» but found nothing.

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