Live data from Hacker News

‘~’ is being removed from Rust

github.com

61–70 of 117 posts

Re: ‘~’ is being removed from Rust

#61

Earlier quoted context omitted.

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.

Could you cite some specific examples? I think that'd really help here.

Well if you had something like

     ~Vec> (not 100% realistic example)
becomes

     Box]>>>>>
which really looks weird. It's like you have tire marks over your code.

Re: ‘~’ is being removed from Rust

#62
post #60

Earlier quoted context omitted.

I guess it's a language primarily by and for text editor users, and I'm beyond that point these days. What do you mean? EDIT: Imagine a programming language designed around an IDE. Fun thought. Not sure whether it's a useful thought, but it's fun to think about.

I actually regret that comment. I feel I was being a bit too negative in my original post, and I don't want to add fuel to the fire by continuing the argument here.

No, no... I'm sorry if my comment sounded strange. I wasn't being ironic or snarky, I was being genuine.

What are your thoughts regarding IDEs vs editors? It's an important topic.

Re: ‘~’ is being removed from Rust

#63
post #11

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.

> 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 be…

words are easier grep for, but I'd rather read x = (2 * 2)/y instead of "x assign 2 plus 2 divide y"

Re: ‘~’ is being removed from Rust

#64
What bugs me isn't the loss of this shorthand, but the decrease in shorthand overall.

Punctuation and other built-in language features give me a baseline for what I can understand and what I can always rely on. If I see ~T, even if I don't know what it means immediately, I still know that it's part of the core language and will get me a step closer to useful understanding; here is a thing I can probably use to solve some problems. Moving as much of the language into a stdlib as possible is a worthy goal that makes for a "cleaner" and more "elegant" language (whatever those mean), but it vastly reduces this effect.

The problem is that all of the core syntax and builtins are probably good to know, but not everything in the stdlib is useful. At least half of the stdlib for any given language tends to be worthless junk. Do you do Python? Did you know about the formatter module? popen2? asynchat? sunau? Probably not. But you almost certainly recognize 100% of Python's syntax and at least 90% of its builtins.

Contrast with Perl, which (besides having a ridiculous amount of built-in syntax) relegates such basics as OO support into the standard library. Subclassing is done by using a library, and there are even two distinct libraries for doing it in the stdlib! So to understand Perl code, you have to understand a good chunk of its stdlib as well, but not all of it because a lot of it is weird obscure junk, but there's nothing telling you which bit is important because it's just a thing everyone knows. (And the reliance on third-party libraries to fill in gaps in the language makes this far worse.)

One of C++'s major offputting properties is that everything is in a bloody library. (The other is that the features it does have all interact in obtuse ways.) You can learn what all of C++'s syntax does, and still be unable to make sense of real-world C++ code. I'd be pretty sad to see that happen to Rust.

Re: ‘~’ is being removed from Rust

#65

Earlier quoted context omitted.

Hmm... I don't understand why it has to be Text Editor vs IDE. The two concepts are orthogonal. One is for editing text; the other is for understanding and autocompleting text. If their concern is that there aren't any good tools for Rust yet, that'll be solved with time.

I think you are missing the point of the statement. If one was designing a language meant to be developed in an IDE, you can hold various assumptions which would influence how syntax shapes up. A trivial example which is not related to rust but I think serves as a decent example, you can assume the IDE will color/italicize/etc member variables to get rid of _var __var var__ nonsense. You can also use slightly less ve…

I'm a little terrified by the prospect of a language designed to be incomprehensible without a stack of tools that will explain it to you.

Re: ‘~’ is being removed from Rust

#66
post #63

Earlier quoted context omitted.

> 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 be…

words are easier grep for, but I'd rather read x = (2 * 2)/y instead of "x assign 2 plus 2 divide y"

Mathematical operators are well established with well known meanings, but the Rust-specific ~ is not.

Re: ‘~’ is being removed from Rust

#67
post #61

Earlier quoted context omitted.

Could you cite some specific examples? I think that'd really help here.

Well if you had something like ~Vec > (not 100% realistic example) becomes Box ]>>>>> which really looks weird. It's like you have tire marks over your code.

Sorry, but I think that example is so unrealistic as to not really be worth discussing.

Re: ‘~’ is being removed from Rust

#68
post #19

~ for allocation was weird, but I will miss lack of ~ as analogy to * . Will they change * to `RawPointer ` too? ;) I'm not happy about change of [T] to Vec either. I hope all these changes will make a full circle and get a first-class syntax back.

> I'm not happy about change of [T] to Vec either. [T] wasn't a thing in Rust. ~[T] hasn't gone and won't go away either. See this email from acrichton: https://mail.mozilla.org/pipermail/rust-dev/2014-April/00935...

That email is somewhat outdated. ~[T] is certainly disappearing with that syntax, becoming Box, andthere has been much back and forth about whether this Box type actually offers anything over Vec, or if it's just a "cute" consequence of the type system.

(The borrowed slices &[T] and &mut [T] are certainly here to stay.)

Re: ‘~’ is being removed from Rust

#69
post #18
post #9

Earlier quoted context omitted.

> Which keyboards do not have a '~' key? Most euro keyboards need at least AltGr + key, possibly 2 keys (because ~ is a dead key, so a space is needed to insert the character itself) > How do those people type a path relative to their home directory? Use $HOME/foo/bar all the time? It's common to `cd; cd foo/bar`

These keyboards usually don't have a convenient way to type {}[] either, these are AltGr + number keys in the German and French layouts for example. The keyboard situation doesn't seem to be as bad as for the degree sign °, which doesn't seem to be typeable on an English keyboard at all.

Not being able to type those symbols causes problems with almost all programming languages (i.e. programmers are likely to have customised their keyboards for those symbols), but ~ is really only a major problem for Rust (and maybe bit-fiddling in C).

Re: ‘~’ is being removed from Rust

#70
post #64

What bugs me isn't the loss of this shorthand, but the decrease in shorthand overall. Punctuation and other built-in language features give me a baseline for what I can understand and what I can always rely on. If I see ~T, even if I don't know what it means immediately, I still know that it's part of the core language and will get me a step closer to useful understanding; here is a thing I can probably use to solve…

From thestinger:

> Rust has strived to remove non-orthogonal features for a long time, and the language has been getting steadily smaller and simpler.

Hereby avoiding the one mistake that made C++ so horrible: lots and lots of non-orthogonal features. It's not just a matter of being cleaner or more elegant. It's a matter of having less to learn.

As for half the standard library being worthless junk… Rust probably won't be doing that mistake. If they simplify the language, they are likely to simplify the standard library as well, which means cutting the worthless junk out. Plus, it will likely be easy to use whatever is most useful: it will be all over the place in tutorials, manuals, examples, and of course actual code.

> One of C++'s major offputting properties is that everything is in a bloody library.

On the contrary, it's an assurance that you can implement bloody efficient data structures yourself, if the STL doesn't do what you want. This is what makes C++ a generally fast language: it's not optimized for special cases.

> You can learn what all of C++'s syntax does,

Most programmers can't. Experts do, but for the rest of us… C++ is impossible to parse, and has many, many, MANY pitfalls: http://www.yosefk.com/c++fqa/

Which is precisely what Rust is trying to avoid.

Post reply on HN