Live data from Hacker News

‘~’ is being removed from Rust

github.com

1–10 of 117 posts

Re: ‘~’ is being removed from Rust

#3
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, as well as not on all keyboards. Plus, in Rust, you should always use stack allocation unless you absolutely have to, and so making heap allocation a little more weighty syntax-wise fits with the goals of the language. `~` -> `box` isn't that much heavier, either.

1: One way it's a superset: previously, only `~` supported 'placement new', and now, all pointers can with `box`. `box` also allows you to specify which allocator you'd like to use.

Re: ‘~’ is being removed from Rust

#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?

Re: ‘~’ is being removed from Rust

#6
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?

My swedish mac keyboard layout forces me to use Alt ¨ + space to type ~. It's certainly annoying and I usually just type "cd" first.

Re: ‘~’ is being removed from Rust

#7
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?

Many international keyboards don't have a tilde key. For example it's not shown on the Finnish/Swedish MacBook Pro keyboard at all.

It's not difficult to type (Alt+¨ followed by a space), but you can't find it by looking at the keyboard.

Re: ‘~’ is being removed from Rust

#8
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?

Check it out: http://en.wikipedia.org/wiki/Tilde#Keyboards

Re: ‘~’ is being removed from Rust

#9
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?

> 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`

Re: ‘~’ is being removed from Rust

#10
For those reading, you need to read comments by "thestinger" very carefully.

A lot of people respond as if he made the following two claims:

1) Recursive data structures are rare

2) Singly linked lists are useless

When in fact he made these two claims:

1) definitions of recursive data structures are not prevalent in code

2) unshared singly-linked lists are not useful

#1 is true since you define a recursive data structure only once, no matter how often you use it.

#2 is slightly less obvious. One of the big advantages of a singly linked-list over other structures is that you can share tails with multiple lists. With unique ownership that advantage goes away. (There is still the use-case of loaning out tails, but that is a fairly weak argument).

Another advantage of a singly-linked list is ease of implementation; that is negated when your standard library provides dynamic arrays and stacks already baked in.

Post reply on HN