We don't use the symbol in our syntax, but are using functional paradigm
that sometimes result in a bit hard to read nested calls.
I'd propose that it works similar to `do`, in that it allows to move the
last expression of an function or method call after the parentheses,
though they would still remain required for ambiguity reasons:
~~~
a(b(c(1,d(2,3,4,e()))))
== a() $ b() $ c(1) $ d(2,3,4) $ e()
let v: ~[uint] = from_iter() $ range(0, 100);
~~~
In that sense, it wouldn't really be an operator but syntactic sugar for
a function call.
It might even be possible to replace `do` with it, though the now
required parentheses would make it longer:
~~~
do task::spawn { ... }
task::spawn() $ || { ... }
~~~
Downside is of course that it adds another symbol, which could alienate
more potentiall users, and it could mean a shift-away-from or at least
an inconsistency-with methods and method chaining in general.
Which would be ironic because I wanted it in some complicated Iterator
chain. ;)
It could of course always be implemented as a syntax extension, and in
any case I don't expect this to get any attention before Rust 2.0. :)
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev