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

Proposal: alias method name in sass #1413

Closed
0xqd opened this issue Sep 1, 2014 · 3 comments
Closed

Proposal: alias method name in sass #1413

0xqd opened this issue Sep 1, 2014 · 3 comments

Comments

@0xqd
Copy link

0xqd commented Sep 1, 2014

It would be great that we can have the alias method in sass, it will help a lot in building concise API. And furthermore, I see that there is a pattern in alias is that :
One method can have an alias or a "negative-alias" ( I haven't found a good name yet for this kind of method ), that the "negative-alias" just returns opposite result of a method.

@function is_true() {
  @return true
}
alias not_false, is_true;
negative_alias is_true, is_false; 
# is_false is internally defined
# @function is_false() {
#   @return not is_true();
# }

This kind of operation is suitable for function either return true or false. But still, we can return array of values or empty array, hash of values or empty hash.

@nex3
Copy link
Contributor

nex3 commented Sep 3, 2014

There's no need to add extra syntax for something that's trivial to do by manually defining a function.

@nex3 nex3 closed this as completed Sep 3, 2014
@lolmaus
Copy link

lolmaus commented Sep 3, 2014

Though i do think that an alias directive would be handy, latest Sass does provide an almost effortless way to define an alias:

@function bar($args...)
  @return foo($args...)

You don't even have to care about the number of arguments.

Demo: http://sassmeister.com/gist/60617e4949b6de85d87a

@0xqd
Copy link
Author

0xqd commented Sep 4, 2014

thanks @lolmaus. That is handy :)

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