Why don't Funcs accept more than 16 arguments?

后端 未结 6 960
情话喂你
情话喂你 2021-02-05 04:54

Since Javascript is the language that I am the most proficient at, I am familiar with using functions as first-class objects. I had thought that C# lacked this feature, but then

6条回答
  •  不思量自难忘°
    2021-02-05 05:24

    I think I understand - what you can do with JavaScript and functions (arguments) is preaty neat but it's also not statically typed.

    But please note that you never need more than one argument in functional programming anyway. You can chain as much argument as you like by returning another function (this is a common trait in FP and heavaly used with curring a technique also avaiable in JS but only with bending the system a bit).

    Of course this is ackward in C#:

    Func>...> 
      x1 =>
        (x2 => 
          (x3 => 
            ... 
              (xn => 
                  { /*return soomething */ }
      ))...);
    

    but this is what F# is for ;) and of course you should never make a function with more than a few arguments (way below 16!) anyhow.

提交回复
热议问题