The current Chan::new() -> (Port, Chan) is confusing because new returns a tuple instead of a new object, 'port' and 'chan' are not intuitive, and the name 'chan' is reused for two purposes (the sender and the total channel).
Some proposed alternatives:
Chan::open() -> (Source, Sink)
Chan::new() -> (Source, Sink)
Chan::new() -> (Sender, Receiver)
Chan::new() -> (Source, Drain)
pipe() -> (Port, Chan)
Also need to consider whether sender or receiver comes first in the tuple.
Nominating.
Discussion: https://mail.mozilla.org/pipermail/rust-dev/2014-January/007928.html
The current
Chan::new() -> (Port, Chan)is confusing becausenewreturns a tuple instead of a new object, 'port' and 'chan' are not intuitive, and the name 'chan' is reused for two purposes (the sender and the total channel).Some proposed alternatives:
Chan::open() -> (Source, Sink)Chan::new() -> (Source, Sink)Chan::new() -> (Sender, Receiver)Chan::new() -> (Source, Drain)pipe() -> (Port, Chan)Also need to consider whether sender or receiver comes first in the tuple.
Nominating.
Discussion: https://mail.mozilla.org/pipermail/rust-dev/2014-January/007928.html