Coming from a functional programming perspective, it would still be very
nice indeed to easily pipeline a series of functions (not methods).

The current method of requiring defining a new trait (with possibly just
one impl!) just to be able to use the `.` syntax means discouraging
functional style in favor of OO style.

If it is "impossible" to allow for `foo.bar(baz)` to be the same as
`bar(foo, baz)`, without giving up on the OO-like behavior (is it,
really?), is there any chance of introducing a whole new operator (such as
`|>`) to do the trick (as in `foo |> bar(baz)`)?

See for example Elixir, which provides both a magic `.` OO-ish "method
dispatch" and also a function-ish pipelining `|>` operator.



On Sun, Oct 20, 2013 at 6:11 PM, Marijn Haverbeke <mari...@gmail.com> wrote:

> I want to add that we did initially have a scheme where you have to
> import every impl you used (not every method), and that this was
> abandoned because it was burdensome and, in typical situations,
> completely redundant.
>
> Another problem with this proposal seems that it does away with the
> possibility of explicitly grouping a bunch of methods that make up the
> implementation of an interface. Implementing interfaces go-style, by
> just happening to have implemented all the methods that make up the
> interface, seems inappropriate for a language where interfaces aren't
> structural.
>
> So I very much agree with Patrick. Some aspects of this proposal are
> attractive, but it breaks some essential properties of the way methods
> currently work (and probably can't be adjusted to work around that
> without losing most of it attraction).
>
> Best,
> Marijn
> _______________________________________________
> 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