3 ms·
a := Bar(baz)(buzz) Is Bar a `func(some) func(thing) other` or is it a `func(type T)(some) other`? You need to know what “baz” is to be able to tell.
by shhsshs 7y ago
a := Bar(baz)(buzz)
Is Bar a `func(some) func(thing) other` or is it a `func(type T)(some) other`? You need to know what “baz” is to be able to tell.
- helper 7y agoNormally you wouldn't write that since the compiler will be able to infer the baz type based on buzz (assuming this is a call to a generic function).
- weberc2 7y agoThat's a fair point, but there are still times when being explicit is useful or even required, and it doesn't hurt to use syntax that disambiguates easily.
- agrajag 7y agoYeah, it's ambiguous, but be realistic: how often are you calling a function with a function return just to invoke that directly? You usually won't see much of either sinice the type argument is only necessary when it can't be inferred.
- imtringued 7y agoIn Haskell this happens every time you call a function with two or more arguments.