Description
Broken off of #36. From that issue:
@evhub: In addition to implicit lambdas as was implemented here, I think it would also be a good idea to add implicit operator functions using the
(? + 5)
syntax, which would be equivalent to(+)$(?, 5)
, since I think the former is a lot easier to read. Reopening this issue to add that syntax.
@fredcallaway: I don't love the idea of a special syntax restricted to operator expressions. Can you come up with a syntax that works cleanly for both(? + 5)
and(foo(?) + 5)
? For example, something like option 3 above.
@evhub: @fredcallaway The syntax(-> _ + 5)
or(-> foo(_) + 5)
was already added and handles those use cases. The rationale for(? + 5)
is that it would generate a partially-applied operator function instead of a lambda, which is significantly better for pickling, casting to a str, profiling, etc.
@evhub: Maybe the right solution is just to detect implicit lambdas of the form(-> _ + 5)
and automatically compile them to partially-applied operator functions, but that seems too implicit and weird to me, so I'm wary to do it.