Live data from Hacker News

‘~’ is being removed from Rust

github.com

101–110 of 117 posts

Re: ‘~’ is being removed from Rust

#101
post #95
post #91

Earlier quoted context omitted.

The OP is, in fact, that document. You'll notice this in a pull request to Rust's RFC repo. This change has been prominently brewing in the Rust community for a long time. The fact is that people have strong opinions about Rust and this is a critical time in its development - people are going to complain.

Yeah, I've read the document, and I would hope that most other people who proceeded to debate the topic did as well. I honestly don't think that it does a commensurate job of presenting the case for it (and after reading many of the comments by proponents, I certainly am under the impression that there is a strong case for it; I just still think the case against it is stronger). A lot of the comments also show widesp…

I can't quite tell from your last sentence if you realise this, but ~ doesn't provide sharing at all: ~T/Box acts like a T in almost all ways, except it is guaranteed to be pointer sized (hence its use in recursive data structures, to allow them to exist without being infinite large). A pointer like Rc is required for sharing.

Do note that the Cons cell construction becomes `Cons(1, box Cons(2, box ...))` which doesn't seem particularly bad.

Re: ‘~’ is being removed from Rust

#102
post #101
post #95

Earlier quoted context omitted.

Yeah, I've read the document, and I would hope that most other people who proceeded to debate the topic did as well. I honestly don't think that it does a commensurate job of presenting the case for it (and after reading many of the comments by proponents, I certainly am under the impression that there is a strong case for it; I just still think the case against it is stronger). A lot of the comments also show widesp…

I can't quite tell from your last sentence if you realise this, but ~ doesn't provide sharing at all: ~T/Box acts like a T in almost all ways, except it is guaranteed to be pointer sized (hence its use in recursive data structures, to allow them to exist without being infinite large). A pointer like Rc is required for sharing. Do note that the Cons cell construction becomes `Cons(1, box Cons(2, box ...))` which doesn…

Thanks for the clarification; I do realise this. The context in which the question arose was that several of the "for" arguments seem to state something to the effect of ~ being rare in code due to only occurring in type definitions.

Re: ‘~’ is being removed from Rust

#103
post #102
post #101

Earlier quoted context omitted.

I can't quite tell from your last sentence if you realise this, but ~ doesn't provide sharing at all: ~T/Box acts like a T in almost all ways, except it is guaranteed to be pointer sized (hence its use in recursive data structures, to allow them to exist without being infinite large). A pointer like Rc is required for sharing. Do note that the Cons cell construction becomes `Cons(1, box Cons(2, box ...))` which doesn…

Thanks for the clarification; I do realise this. The context in which the question arose was that several of the "for" arguments seem to state something to the effect of ~ being rare in code due to only occurring in type definitions.

I believe that was just addressing the fact that the type `Box` is more annoying than the type `~T`, since the `box expr` replacement for the `~expr` expression is relatively nice (admittedly I wasn't following the discussion in great detail).

Re: ‘~’ is being removed from Rust

#104
post #59

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.

And we shall call it Java.

Actually we call them Smalltalk, Interlisp, Delphi, Visual Basic and Eiffel.

Re: ‘~’ is being removed from Rust

#105
post #81

Earlier quoted context omitted.

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

The key to this comment is "[t]he latest startup/trendy tech boom has made a disproportionate number of people of this type gravitate towards programming". The rest can be extrapolated from that sentiment.

Re: ‘~’ is being removed from Rust

#106
post #97
post #91

Earlier quoted context omitted.

The OP is, in fact, that document. You'll notice this in a pull request to Rust's RFC repo. This change has been prominently brewing in the Rust community for a long time. The fact is that people have strong opinions about Rust and this is a critical time in its development - people are going to complain.

I could have put some more thought into this response. As Rust becomes more popular while we try to bring home the last few major changes, we've had this problem a few times, where the broader community is surprised and partially shocked and disappointed at a change that has been brewing for a while. Certainly, more effort could be put into messaging and explaining how big changes are going to effect users. Figuring…

Thanks for the detailed response. I understand that having to deal with this sort of situation instead of working on bringing the project closer to fruition must be very annoying from a core developer's perspective. Sorry for contributing my part to this being dragged out further.

To clarify, what has distraught me the most about this change is not even the change itself (although I do think that, however small or warranted on its own it may be, it may have long-term ramifications that need to be considered much more carefully), but the way the process seemed to diverge from the fairly open and inclusive discussion that seemed to regularly take place in the past. This change may well have been brewing somewhere for a while, but from the point of view of someone who is not in the "inner circle", what was perceivable of it essentially was the thread I linked above some 16 days ago (which was remarkably full of responses by apparent "insiders" that aimed to discourage people from discussing the topic at that point in time) and the thread announcing the RFC, in which even some of the most basic questions needed for a casual observer to understand the tradeoffs were unanswered when the proposal of the RFC was mainlined something like half a day later.

The end result is something that looks similar to what happened with GNOME 3 to someone who was in the opposing camp in both cases, where the "in-group" at some point decided that they had identified a development agenda of utmost importance to what has in fact been part of the central mission of the project all along, and increasingly came to send the message that they held disagreeing members of the "out-group" to be obsessive hecklers and people who should just get out already if they don't like it - although nothing says it has to end up like that, where this took the state of Linux desktop environments is easily observed nowadays.

When considering the overall lifecycle of a project, the number of remaining "difficult decisions" is a far more accurate metric of completion than code or concept. Frustratingly, it is pretty much bound to increase towards the full end of the scale of the latter when the development process is a highly public affair. People wouldn't argue this topic with such ferocity if it wasn't for their appreciation of your work so far and high expectations for this project; please don't let that go to waste by shortcutting the decision process when you have come this far.

Re: ‘~’ is being removed from Rust

#107
post #105
post #81

Earlier quoted context omitted.

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

The key to this comment is "[t]he latest startup/trendy tech boom has made a disproportionate number of people of this type gravitate towards programming". The rest can be extrapolated from that sentiment.

I understand that the sentence you quoted is easily construed as a cheap potshot at startups, but all I meant to say is that suddenly, there is a large number of people coding - and, more importantly, writing about coding - who did not grow up staring at mangled C++ debug symbols and hex dumps. I don't mean to say not doing that makes you a worse programmer - the difference does, however, seem to explain the composition of two groups who like shouting things to the effect of "I don't understand how you can find that easier to read than this" at each other.

Re: ‘~’ is being removed from Rust

#108
post #81

Earlier quoted context omitted.

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

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

Syntax is a very small part of the overall design. Rust won't stop being Rust just by removing a few confusing sigils.

Re: ‘~’ is being removed from Rust

#109
post #39

Earlier quoted context omitted.

I've been reading a bunch of tutorials and such, including the official one, about Rust recently and you'd get the impression that using unique pointers were the norm. This discussion seems to suggest they should be generally avoided. Now I'm not sure if I've just been massively misreading everything (I come from a background in GC languages) or whether the messaging about usage is way off.

Well, the official pointer tutorial, which I wrote, says right up front that you should prefer stack allocation: http://static.rust-lang.org/doc/master/guide-pointers.html Unique pointers are one of Rust's newest, shiniest features, so they do get talked about a lot. Probably disproportionally so. Honestly, it's probably that the docs are still coming together. The tutorial is notoriously poor, Mozilla has hired some…

Re-read the pointer tutorial and yes I've clearly mis-remembered that so apologies! You're probably right that there's just a lot of discussion about them at the moment.

Anyway I'm very excited about Rust, really looking forward to 1.0.

Re: ‘~’ is being removed from Rust

#110
post #87

Earlier quoted context omitted.

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.

"Node" is the name I used to talk about the cons cells your singly linked list is made up of.

Now 2 things.

First, the tiled denotes unique pointers. Your example was a singly linked list. Singly linked lists have 2 important characteristics: adding or removing the first element is O(1), and the tails of those lists can be shared. With unique pointers, you can't share. By design. If you want several references to a "node", you need to use shared pointers, whose allocation is manage by reference counting or garbage collection. So you have a data structure whose only advantage is O(1) insertion and removal… of the head. That's not very useful to begin with, considering the absurd amount of heap allocation you need to do. Other data structures fare better (vectors, ring buffers…).

Second, your example supposes the existence of a `cons()` function to begin with. If you really want to use unique pointers, you should write a function that accepts values, and wraps them in a pointer instead. That way, you can write `cons('A', cons('B', cons('C', empty)))`. There, no more pesky tiled: they have been factored in the definition of `cons()`. Less repeating yourself for the win.

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

Not quite. I'm saying the constructor itself should take care of the boxing operation. When devising a data structure, you generally know what it will be used for. It's memory allocation scheme should be a part of it. Hidden, if possible. For instance, unique pointers have value semantics. As such, they're an implementation detail. Leave them out of the interface. If it turns out you didn't need them after all, you can scrap them without breaking outside code.

Hmm, I guess that makes three…

Post reply on HN