disentangling (c) => c()

Viewed 26

I have an issue with : (c) => c() which I found here and there. I understand that it defines an anonymous function with an untyped parameter, c. But then it seems to refer

  • to a parameter-free undefined function c(), i.e. having the same name as the parameter of the initial-anonymous function,
  • or to its own parameter c as if this very parameter were a parameter-free undefined function it-self.

I'm pretty sure that I did not get it right and that I miss the point, but any hint would help to untangle (c) and c(), and grasp what the function ends up doing for real.

1 Answers

It is an anonymous function that gets something named c. It then calls what it gets as if it were a function. That implies that the compiler figured out that it either is a function with no parameters, or it is a dynamic. Otherwise the compiler would have complained.

So in english: an anonymous function that has a parameter named c. The type of that parameter is "function with no parameters". It then calls the function it just got as argument.

Related