7 ms·
Feh. It's an interesting split between what I'll call the concisionists and the explicitists. As a concisionist, this change stinks. I appreciate that the "not
by pnathan 13y ago
Feh. It's an interesting split between what I'll call the concisionists and the explicitists.
As a concisionist, this change stinks. I appreciate that the "not on my keyboard" argument is a big deal, but I'd argue that just merits a change of sigil, not adding verbosity.
Designing a language to be prolix just makes code more laborious to understand.
- masklinn 13y ago> As a concisionist, this change stinks. There's two side to it: it makes creating unique pointers slightly harder, but at the same time it makes (unnecessary) overuse of unique pointers slightly harder/less likely, and that looks to be a concern of the core team. > Designing a language to be prolix just makes code more laborious to understand. Does it make the code more laborious to understand though? The concept becomes easier to search for and it's easier to talk about it (both because box/boxing is a term of art, and because "box" is a single syllable).
- cgag 13y agowords are easier grep for, but I'd rather read x = (2 * 2)/y instead of "x assign 2 plus 2 divide y"
- pnathan 13y agoThere's a nuance to point #2. The right amount of concision expresses the situation perfectly to someone skilled in the art, without requiring further reading to grasp or without requiring unneeded information to be waded through. (philosophy) A language should support concision to allow those skilled in the art to use their time effectively.
- Alphasite_ 13y agoI 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 13y agoCould you cite some specific examples? I think that'd really help here.
- Ygg2 13y 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 13y agoSorry, but I think that example is so unrealistic as to not really be worth discussing.
- Pacabel 13y 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 13y 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.
- loup-vaillant 13y ago> As a concisionist, this change stinks. Hardly. As thestinger argued so eloquently, legitimate use of the ~ are few and far between: typically, recursive data structure definitions, which are rare even when you go Recursive Crazy. (Functional programming would even avoid unique pointers, since they prevent sharing.) From an information theoretic perspective, giving a special syntax for such an uncommon use doesn't make sense. If you want your language to be concise, you want the short-cuts to be used for frequent cases. Before we give a special syntax to unique pointers, we should address everything that's more often used. That would turn Rust into APL. Since we don't want such a combinatorial explosion of special symbols, we're back to the good old Huffman encoding: short cuts for the frequent use cases, more verbosity for the rare ones.
- 4bpp 13y ago> legitimate use of the ~ are few and far between: typically, recursive data structure definitions Wait, don't you need it to instantiate the corresponding recursive data structures? As in, a typical cons-cell list would be created in a fashion like Cons(1, ~Cons(2, ~Cons(3, ~Nil))).
- loup-vaillant 13y agoThat's an illegitimate example. Exposing unshared nodes like that does no good. Just write a cons function that embed the unique pointer, that will get rid of the tilde, and make for an even better syntax than what you just showed.
- 4bpp 13y agoSorry, I don't think I understand; could you explain what you mean by "exposing unshared nodes"? Also, are you saying that for every self-referential constructor of an algebraic datatype, the correct thing to do is to write a boilerplate function that simply wraps the constructor and a call to whatever the boxing operation winds up being...? That seems somewhat odd.
- 13y ago