[rust-dev] RFC: New Rust channel proposal

Benjamin Striegel ben.striegel at gmail.com
Fri Jan 24 05:34:03 PST 2014

> Channel should be a struct

This is feasible:

    let Chan { send, recv } = Chan::new();

...but it seems needlessly verbose, given that literally 100% of the time
you will want to separate the sending end from the receiving end. It makes
no conceptual sense to have a `Chan` as a discrete entity, when it's
effectively just an abstraction for two entangled endpoints.

Anyway, if we've devolving into bikeshedding then it might be time to
abandon this thread. Usability isn't something that can be crowdsourced.

On Fri, Jan 24, 2014 at 7:23 AM, Lee Braiden <leebraid at gmail.com> wrote:

>  On 24/01/14 03:54, Brandon Sanderson wrote:
> I would expect Channel::new() to create a channel object that either lets
> me send and receive, or lets me get a source and sink to send and receive
> with.  Borrow rules may prevent this, but my point is that Channel::new()
> would generally be expected to return a struct, and not a tuple.
> Yes.  I think either:
>     * Channel should be a struct, created by Channel::new(), with sender
> and receiver instances as fields (by whatever name) -- essentially, the
> tuple should become a struct, with better naming of port and chan
>     * Channel should have a  ChannelTrait implemention, with send() and
> receive(), and should be created by Channel::new()
> But from what Benjamin says below, it seems like the latter isn't
> necessary.
>  On Jan 23, 2014 7:29 PM, "Benjamin Striegel" <ben.striegel at gmail.com>
> wrote:
>>  This all seems a bit silly. A channel *is*, conceptually, a tuple of a
>> sender and a receiver. If I call Chan::new(), that's what I expect to get.
>> And Chan::open() doesn't map to anything that's as intuitive.
> --
> Lee
> _______________________________________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140124/38c0e37d/attachment-0001.html>

More information about the Rust-dev mailing list