[rust-dev] RFC: New Rust channel proposal

Strahinja Markovic val at markovic.io
Thu Jan 23 19:16:01 PST 2014


On Thu Jan 23 2014 at 3:59:56 PM, Steve Klabnik <steve at steveklabnik.com>
wrote:

> I don't think that `new` not returning a `Channel` is a big deal.
> Conceptually, you are, both ends 'make up' a channel.
>

I agree it's not a big deal, but I still think it's something we might want
to change. Why introduce a mental speed bump if we don't have to?
Foo::new() returns a Foo, Bar::new() returns a Bar, Quux::new() returns a
Quux and a Channel::new() returns a... tuple of two items, neither of which
is a Channel (I know the two items together are conceptually a *channel*,
but they are not a Channel).

Using new() here seems like a usability loss for no benefit. But again,
it's not a huge issue (should still be fixed though).

Port & Chan are a bigger problem since users will forever have to
double-check which is which or will have to remember it.

Why the cognitive load? Channel::new_pipe() returning (Source, Sink) is a
usability win we get for free.

I know I don't have to convince anyone here just how critical good naming
is.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140124/57ab5055/attachment-0001.html>


More information about the Rust-dev mailing list