Sure, I think my wording was poor here. The point I meant to make was that, AFAIK, there is no place where it is possible to create a closure without a double bar, and I think that sort of visual signaling is useful. I spend a lot more time reading others’ code than writing my own, and being able to see at the call site that a closure, and not a value, is being passed is valuable for readability. For comparison, Scala’s def foo(f: => A) (by-name parameters) creates lambdas out of bare expressions, which are convenient when writing code but make it frustrating to determine if a function call is secretly constructing a lambda, since I might need to jump to a different file.
I think one can argue that this sort of sugar is comparatively harmless, like auto-deref, but for now I remain skeptical.
I don’t know that I suggested otherwise? I assumed your proposal was like Scala’s foo(1) _ syntax, rather than Haskell’s bona-fide curried functions.
No, but function overloading is a feature present in many popular languages (e.g. Java, C++) that is orthogonal to currying. This syntax would probably leave a lot of new Rust users scratching their heads. I don’t think an argument can be made for this like was made for using try blocks; at least try blocks involve code that needs error-handling.
I think comparing Haskell and and Rust syntax is just going to lead us astray. For example, in Haskell, I can write the following, since every function in Haskell takes exactly one parameter (modulo sugar to make it look like functions can take multiple parameters).
foo :: (t, t) -> t
foo (a, _) = a
t12 = (1, 2)
f12 = foo t12
-- alternatively,
f12 = foo (1, 2)
This does not work in Rust, since functions can take more than one parameter:
fn foo<T>(a: T, _: T) -> T { a }
let t12 = (1, 2);
let f12 = foo(t12); // error[E0061]: this function takes 2 parameters but 1 parameter was supplied
// this is the only correct alternative
let f12 = foo(1, 2);