Created
June 29, 2011 09:52
-
-
Save func09/1053552 to your computer and use it in GitHub Desktop.
CoffeeScriptで2つのメソッド引数を取るとき、美しく書きたい・・・
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hoge = (func1, func2) -> | |
alert func1.apply() | |
alert func2.apply() | |
# NG | |
hoge () -> 'a', () -> 'b' | |
# NG | |
hoge (() -> 'a', () -> 'b') | |
# OK 美しくない | |
hoge () -> 'a' | |
, | |
() -> 'b' | |
# OK 一度変数につっこむ | |
_1 = () -> 'a' | |
_2 = () -> 'b' | |
hoge _1, _2 | |
# OK by @ruedap http://twitter.com/ruedap/status/86018496928022528 | |
hoge (() -> 'a') , (() -> 'b') |
satyr
commented
Jun 29, 2011
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment