I don't follow. ~Trait is a pointer, and therefore its size is fixed. There
are checks in place to prevent using a trait as a type (there's a nice
error message from the compiler saying "using trait as a type" :-)... So
the Trait in ~Trait isn't a _type_, right? :-)

On Sat, Nov 9, 2013 at 12:04 AM, Patrick Walton <[email protected]>wrote:

> On 11/8/13 2:00 PM, Oren Ben-Kiki wrote:
>
>> So, the core question is whether we think of str as an object or as a
>> pointer. Either we see it as an object (with fixed size, 3 words), which
>> internally holds a nested pointer to a dynamically-sized region of
>> characters; or we see it as a direct smart pointer to this array.
>>
>> The "physics" of str seem to be the former, but the abstraction
>> presented to the programmer is the latter. Of course, there's also value
>> in providing clean abstractions, but this is a leaky one. For example,
>> it isn't very clean to have a concrete type T which allows ~T, &T, @T,
>> *T but forbids having a simple T (unless one is talking about a trait,
>> which str isn't). It is weird and causes all sort of edge cases when
>> trying to write generic code.
>>
>
> You're arguing that we shouldn't have dynamically sized types, but I ask
> what your solution to `~Trait` is then.
>
> Patrick
>
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to