Live data from Hacker News

‘~’ is being removed from Rust

github.com

21–30 of 117 posts

Re: ‘~’ is being removed from Rust

#21
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…

There'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.

Re: ‘~’ is being removed from Rust

#22
post #5

Here's a quick summary: Rust is adding a new capability, `box`, which is a superset of the existing pointer functionality.[1] Therefore, this special case is being removed, and, if it turns out that `~` is missed, sugar can be re-introduced to bring it back. That said, I don't think it will be. It's only really useful in function signatures, since types are inferred everywhere else, and `~` is harder to search for, a…

> `~` is harder to search for, as well as not on all keyboards. Which keyboards do not have a '~' key? How do those people type a path relative to their home directory? Use $HOME/foo/bar all the time?

I rarely use ~ for my home directory, and I type on a US keyboard. ~/ is three inconvenient keystrokes; cd is three convenient keystrokes.

Re: ‘~’ is being removed from Rust

#23
post #12

Earlier quoted context omitted.

Does this change affects managed box? Or it only affect owned box?

You'll allocate a managed box with let x = box (GC) 5; if my memory serves. The argument to `box` defaults to HEAP, so these are the same: let x = box (HEAP) 5; let x = box 5; And of course, boxing an integer is silly. This is just for illustration. The @ for managed boxes has been removed from the language for a while now. It's not technically gone because there's one or two instances in the compiler, IIRC, but it s…

Thanks for the explanation! This change makes the code more clear to me. When I first read some rust code, those ~ and @ are annoying because I don't know their meaning and hard to search them for a explanation. The box keyword is a much better way for developers.

Re: ‘~’ is being removed from Rust

#24
post #23

Earlier quoted context omitted.

You'll allocate a managed box with let x = box (GC) 5; if my memory serves. The argument to `box` defaults to HEAP, so these are the same: let x = box (HEAP) 5; let x = box 5; And of course, boxing an integer is silly. This is just for illustration. The @ for managed boxes has been removed from the language for a while now. It's not technically gone because there's one or two instances in the compiler, IIRC, but it s…

Thanks for the explanation! This change makes the code more clear to me. When I first read some rust code, those ~ and @ are annoying because I don't know their meaning and hard to search them for a explanation. The box keyword is a much better way for developers.

Thank you. That's exactly our thought process too, though there is some reasonable disagreement about it.

Re: ‘~’ is being removed from Rust

#26
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.

>first-class syntax

Perl-y symbol nonsense is not a first-class syntax

Re: ‘~’ is being removed from Rust

#28
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…

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.

Re: ‘~’ is being removed from Rust

#29

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…

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.

Re: ‘~’ is being removed from Rust

#30
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...

Post reply on HN