[rust-dev] Unbounded channels: Good idea/bad idea?

Nathan Myers ncm at cantrip.org
Wed Jan 1 01:51:04 PST 2014


On 12/31/2013 01:41 PM, Patrick Walton wrote:
 > Bounded channels can be constructed from unbounded channels as well,
 > so I don't see how this is an argument for making bounded channels
 > the primitive.

Sometimes we need an indefinite-precision integer, other times a
fixed-size integer. Sometimes we need a variable-sized array, others
a compile-time fixed-size array. A range-limited integer or array
can be constructed using the unrestricted type, but would lack exactly
those properties it needs in order to usable where you need one.

It should be clear that in each case one type is more fundamental,
implementation-wise, than the other, and can be used in circumstances
where the other is entirely unaffordable. One is necessarily primitive,
while the other can be constructed from primitives with no performance
penalty or restrictions.

There are many languages that offer indefinite-precision integers
and variable-sized arrays as primitives. No one uses them for
system coding.

Nathan Myers



More information about the Rust-dev mailing list