You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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: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.The text was updated successfully, but these errors were encountered: