Live data from Hacker News

‘~’ is being removed from Rust

github.com

81–90 of 117 posts

Re: ‘~’ is being removed from Rust

#81
post #34

I'll be honest: Rust is kind of losing me with these changes. I started following/tracking the language about a year ago, and I thought the syntax looked really succinct and easily readable back then, but with changes like this, [T] => Vec , the region/lifetime syntax, together with the propensity to abbreviate almost everything, code is quickly starting to look kind of soupy to me. I get the arguments, and they're l…

Odd, I've just been getting the impression that the language is become much, much readable. I agree with thestinger, here: > uses and instead of &&, or instead of ||, list instead of [] and so on. Most people find it far easier to read and search for these than the sigil alternatives. The avoidance of more than one way to do the same thing (like including both ~T and Box ) is another reason why people find Python eas…

What is the source of that statement? Because honestly, if the future of Rust is to look like this, that would be somewhat horrifying.

Python is a great language for beginners and people who get into programming through nontraditional channels without having much of a symbol-pushing background; presumably, being able to parse symbolic expressions naturally is a skill that needs to be learned, and perhaps even needs to be learned early in life to wield effectively. If you don't have the ability, classical systems languages will look like malicious ASCII soup and a language whose code you can actually read like a paragraph of text will be long-overdue respite from this misery; the same perhaps even applies to other non-verbose shorthand (as an anecdote, one of my graduate program's logic-heavy classes is currently suffering from a student who more or less constantly interrupts the lecture to get all the mathematical notation on the board read out to him in natural language). The latest startup/trendy tech boom has made a disproportionate number of people of this type gravitate towards programming, many of them coming from the wider blogosphere/"social internet"; as a result, their opinions regarding what is good or bad and legible or illegible have come to entirely dominate the airwaves. It is all to easy to forget that there is a barely visible core of often significantly more prolific "native" programmers hiding in newsgroups/IRC channels/mailing lists and more often than not having very different measures regarding what constitutes good language design. When Rust came about, its design held the promise to finally deliver something to this group that might offer a way out of the C monastery; having it reorient itself to appeal to more popular sensibilities at this point is bound to cause a lot of hard feelings.

Personally, I always found the flat monotonicity of Python code to be rather unpleasant to read and write. Having what some people like to denounce as "line noise" actually enables a very useful visual contrast between "structural" (parentheses, scope boundaries, operators) components of the code and largely user-defined "names". Looking at a piece of code like "if(vals[1]==1 && vals==[1,2,3]) { ... }" allows you to break up the code visually before having read and echoed to yourself even a single word of natural language; this can't be said of a (hypothetical) example like "if vals.at(1) equals 1 and vals equals list(1,2,3):". Adding to that the general lack of code layout flexibility and the deliberate lack of alternatives to express a given pattern, the resulting picture is that the way an experienced programmer would usually gather a slew of information from diagonally skimming over a piece of code (segmenting all of it using the visually distinct "line noise", gathering when and how data is accessed, inferring the original writer's priorities from how the code was spaced out and what constructs were chosen, spotting the names of external dependencies...) is severely crippled.

Re: ‘~’ is being removed from Rust

#82

Not specifically related to this exact rust topic, but the interest in rust made me add support to my compiler explorer so you can tap rust code and see how it compiles interactively at http://rust.godbolt.org

That's very cool; how do you get colourise to associate lines to the regions of assembly?

Re: ‘~’ is being removed from Rust

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

At least on a German keyboard, the required for Box is a more painful combination to type, as is the shifted version of the same. At the same time, ~ is right alt and +, where + is roughly where ] is on a US English keyboard.

With my typing style, the former is a complex press-release sequence with the left pinky and ring finger, whereas the latter is a single chord executable with the right thumb and ring finger.

Re: ‘~’ is being removed from Rust

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

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

Re: ‘~’ is being removed from Rust

#85
Honestly. it feels like the language is losing something. I'm having a hard time identifying what that is, but I think it's something like the 'Rusty-ness' of the language, similar to how code can be more or less 'Pythonic'.

The language is still in flux and there is only one way to find out whether we will miss '~'. Let's do it.

Re: ‘~’ is being removed from Rust

#86
post #84

Earlier quoted context omitted.

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

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

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

Re: ‘~’ is being removed from Rust

#87
post #84

Earlier quoted context omitted.

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

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

Sorry, 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.

Re: ‘~’ is being removed from Rust

#88
post #14

Is this a good time to point out that the language is stabilizing?

It seems to me that the current focus on "do all the breaking changes we want to do so that we can get to 1.0" naturally leads to a prevalence of breaking changes. So in a strange way, yes, this sort of breaking change is evidence of the language stabilizing.

I don't think we can really consider it to be "stabilizing" when there are relatively significant and breaking changes like this still going on.

It may be headed in the direction of stability, but that's quite different from stabilizing.

We can consider it to be stabilizing once the language and standard libraries have been frozen, and the only changes happening are very minor ones that are fixing critical bugs.

Until then, it's still in the research and development stage, at best.

Re: ‘~’ is being removed from Rust

#89
post #77

Earlier quoted context omitted.

We still have "fn". :)

fn is my favorite keyword for function definition. "function" is too long. "def" doesn't say anything about functions (unless you read it as DEfine Function). "func" sounds too funny. "defun" always reads "defunct" to me. And just out of curiosity, where did the rust designers get the inspiration for "fn"? I know plan 9 rc and clojure have "fn". Or maybe it's independent invention?

Well, I slightly prefer "fun", but the Rust community pretty firmly favors "fn", and they're about the same anyway.

As far as I know it came from ML.

Re: ‘~’ is being removed from Rust

#90
Orthogonally to whether this is a good or bad idea, I really wish the PR and subsequent community management had been handled more carefully for something that was pretty much bound to be a very controversial change (tellingly, /r/rust even had a preemptive thread about it before it materialised: http://www.reddit.com/r/rust/comments/236plz/thoughts_on_rem... ). Although I perhaps am in a bad position to complain after having been caught up in the less savoury parts of the exchange myself, I can't help it but believe that the often outright hostile tone and the swift wagon-circling by the proponents (in response to what they probably felt was an unreasonable onslaught of repetitive criticism) will have left a very bad aftertaste with a lot of readers. Much of this could have been prevented by preparing a clean document explaining the motivation and ramifications of the change to a general audience in advance, and perhaps by having the moderators apply some gentle pressure on the loose guns on either side to pipe it down.
Post reply on HN