Argh, I forgot about macros! Nevermind then. :P

On 09/25/2013 08:33 PM, Benjamin Striegel wrote:
Note that we reserve the dollar sign ($) for use in macros, so it wouldn't be able to appear in regular Rust code without some sort of escaping mechanism. I also don't see anything like this happening before Rust 2.0 at the earliest.


On Wed, Sep 25, 2013 at 2:40 PM, Marvin Löbel <loebel.mar...@gmail.com <mailto:loebel.mar...@gmail.com>> wrote:

    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 <mailto:Rust-dev@mozilla.org>
    https://mail.mozilla.org/listinfo/rust-dev




_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to