[rust-dev] PSA: ~"string" is probably not what you want

Patrick Walton pwalton at mozilla.com
Sun Apr 28 12:49:01 PDT 2013

On 4/28/13 12:45 PM, heri16 at gmail.com wrote:
> It is very easy to create a language that is unwieldy, but hard to
> create something KISS simple that can be adopted, and that will be
> praised for its cleanliness and elegance.
> If the basic things are not simple, a language will be relegated to
> academia, and will not be as popular as hoped.
> We really need to take a look into this one, and come up with something
> workable. That won't be easy considering what Patrick has mentioned.

As Daniel pointed out, it isn't so bad. I didn't realize that we already 
borrow on the left hand side, so you can write:

     fn main() {
         let x = ~"foo";
         if "foo" == x {

We just need to borrow on the right hand side too, so that `x == "foo"` 
works. I can think of ways to do it; none are particularly pretty, but I 
suspect we could make it work. But the situation is not so dire now.


More information about the Rust-dev mailing list