As a potential user of the language I've been toying with using combinators
to make compile-time checked DSLs, and this would be enourmously useful.

Rust is still lacking a few features for my proposed use case (varargs
and/or kwargs would be fantastic, but I'm already well aware that those are
post-1.0 requests).

However, I disagree with the idea that it would alienate users. Function
composition is useful but not as critical as in a language like Haskell,
and aside from the admittedly difficult memory management concepts Rust
introduces, it is a very clean and easy-to-understand language, and has far
fewer caveats than both C and C++ (at least so far), and much less
complexity than academic functional languages.


On Wed, Sep 25, 2013 at 3:40 PM, Marvin Löbel <[email protected]>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
> [email protected]
> https://mail.mozilla.org/**listinfo/rust-dev<https://mail.mozilla.org/listinfo/rust-dev>
>



-- 
Andrés Osinski
http://www.andresosinski.com.ar/
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to