[rust-dev] In favor of types of unknown size

Benjamin Striegel ben.striegel at gmail.com
Sat Apr 28 11:03:00 PDT 2012


> I'd honestly be ok with going back to vec<T> or vec<mut T> for the vector
type and using [T] for the slice, to discourage this hazard.

I think this could be a win for clarity. There are enough potential use
cases here that overloading [] doesn't seem to give all that much benefit.

On Sat, Apr 28, 2012 at 6:53 AM, Patrick Walton <pwalton at mozilla.com> wrote:

> On 04/27/2012 03:15 PM, Niko Matsakis wrote:
>
>> Hi,
>>
>> This is a post I recently put on my blog. I thought I'd post it to the
>> mailing list as it pertains to our recent discussion on the syntax of
>> vectors, slices, and so forth. I feel like I'm harping on this issue so
>> I think it's the last thing I will write about it for a while. =)
>>
>
> I like the idea of eliminating [T]/@ in favor of @[T]; it simplifies the
> user-facing syntax and semantics a lot.
>
> On the other hand, I agree with Marijn that []T doesn't look as nice as
> [T] (although Go is popularizing the former). [:]T is also strange-looking.
> There's also the issue that users might use &[]T, which is almost never
> useful, instead of the more-useful [:]T. I'd honestly be ok with going back
> to vec<T> or vec<mut T> for the vector type and using [T] for the slice, to
> discourage this hazard.
>
> Patrick
>
> ______________________________**_________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/**listinfo/rust-dev<https://mail.mozilla.org/listinfo/rust-dev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20120428/7b0df382/attachment.html>


More information about the Rust-dev mailing list