5 ms·
I would argue that yes, it does. The examples I've seen of the change have become a mess of letters and i'm not too fond of it.
by Alphasite_ 12y ago
I would argue that yes, it does. The examples I've seen of the change have become a mess of letters and i'm not too fond of it.
- steveklabnik 12y agoCould you cite some specific examples? I think that'd really help here.
- Ygg2 12y agoWell if you had something like ~Vec<~Vec<~Vec[~T]>> (not 100% realistic example) becomes Box< Vec< Box< Vec< Box< Vec[Box<T>]>>>>> which really looks weird. It's like you have tire marks over your code.
- dbaupp 12y agoSorry, but I think that example is so unrealistic as to not really be worth discussing.
- Pacabel 12y agoI wouldn't be so quick to dismiss it. Maybe that exact situation won't often arise, but in other languages like C++, Java and C# it's not at all uncommon to have nested collections.
- dbaupp 12y agoYes sure; but it is rare to have indirection for every layer of a nested collection (i.e. each collection will essentially be a pointer to some data, with a little bit of metadata (like length & capacity for a Vec), so having Box<Vec<T>> is a pointer to a pointer to the data: essentially pointless!). In other words, one would write Vec<Vec<Vec<T>>> That might be considered ugly, but it's not ugliness caused by the `~` change.
- Ygg2 12y agoCould the opposite happen? What if you have `~~` pointer or `~&~` pointer?
- pcwalton 12y agoI've never seen `~~` except for workarounds caused by the current lack of dynamically sized types (which is being fixed). `~&` is not very useful, as you'd be placing a stack-bounded lifetime on the heap (except for 'static, I suppose, but I've never seen that).