Live data from Hacker News

‘~’ is being removed from Rust

github.com

11–20 of 117 posts

Re: ‘~’ is being removed from Rust

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

Re: ‘~’ is being removed from Rust

#12

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…

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

Re: ‘~’ is being removed from Rust

#13
post #12

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…

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 should be gone Real Soon Now.

Re: ‘~’ is being removed from Rust

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

> You'll allocate a managed box with let x: box (Gc) 5;

It's GC in full uppercase FWIW, it's a static marker[0] not the type name. And the syntax already works in 0.10 (although funnily enough only HEAP and GC exist, no e.g. RC)

> The argument to `box` defaults to HEAP, so these are the same:

Yep[1].

[0] http://static.rust-lang.org/doc/0.10/std/gc/index.html

[1] http://static.rust-lang.org/doc/0.10/std/owned/index.html

Re: ‘~’ is being removed from Rust

#16

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…

> You'll allocate a managed box with let x: box (Gc) 5; It's GC in full uppercase FWIW, it's a static marker[0] not the type name. And the syntax already works in 0.10 (although funnily enough only HEAP and GC exist, no e.g. RC) > The argument to `box` defaults to HEAP, so these are the same: Yep[1]. [0] http://static.rust-lang.org/doc/0.10/std/gc/index.html [1] http://static.rust-lang.org/doc/0.10/std/owned/index.ht…

Thanks, I've uppercased it.

Re: ‘~’ is being removed from Rust

#17
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 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).

Re: ‘~’ is being removed from Rust

#18
post #9
post #5

Earlier quoted context omitted.

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

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.

Re: ‘~’ is being removed from Rust

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

Re: ‘~’ is being removed from Rust

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

French layout keyboards do have a convenient way to type {}[], for me with Canadian French it is under 7890 using alt.
Post reply on HN