[rust-dev] RFC: New Rust channel proposal

Eric Reed ecreed at cs.washington.edu
Tue Jan 14 21:26:22 PST 2014


As a follow up, what situation would arise where you'd have to actually
return a Chan trait object?
Constructors are going to return the concrete type UniqueChan/SharedChan.
Functions acting on channels can just use generics, which will allow
returning.


On Tue, Jan 14, 2014 at 9:21 PM, Eric Reed <ecreed at cs.washington.edu> wrote:

> fn foo<T: Trait>() -> T
>
>
> On Tue, Jan 14, 2014 at 9:20 PM, Jack Moffitt <jack at metajack.im> wrote:
>
>> You can't do `foo() -> Trait`. It would have to be `foo() -> ~Trait`.
>> Well, unless DST fixes this. I assume this is the same reason we
>> return specific instances of iterators instead of an Iteratable trait
>> object.
>>
>> jack.
>>
>> On Tue, Jan 14, 2014 at 10:10 PM, Eric Reed <ecreed at cs.washington.edu>
>> wrote:
>> > How would that make us lose stack allocated return values?
>> >
>> >
>> > On Tue, Jan 14, 2014 at 5:22 PM, Jack Moffitt <jack at metajack.im> wrote:
>> >>
>> >> > Good point. Make `Chan` a trait with implementers `UniqueChan` and
>> >> > `SharedChan`?
>> >>
>> >> I suppose the main downside of that solution is that you lose stack
>> >> allocated return values.
>> >>
>> >> jack.
>> >
>> >
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140114/b5cd3482/attachment-0001.html>


More information about the Rust-dev mailing list