Hacker Newsnew | past | comments | ask | show | jobs | submit | MaxSize's commentslogin

I know there are various pointer type prefixes in Rust (@foo, ~foo, &foo, *foo), 'foo for lifetimes and $foo for macro arguments, but WTH is +foo? https://github.com/mozilla/rust/blob/master/src/librustc/mid...

I haven't seen this in the documentation.


A very old, very very deprecated feature. I believe pcwalton's working on removing the last vestiges of it from the compiler as we speak. The feature was called "argument modes", but it's been deprecated for so long that almost nobody remembers precisely how they were used (very few understood it in the first place). They were quite pervasive in the early 0.0 days, and it's taken this long to remove them completely.

In addition to the +foo forms, there were also others: -foo, &&foo, ++foo, perhaps more. Be glad that they're gone. :)


They're called "modes" and were a way of controlling whether parameters were copied or passed by reference etc (I think). It's been deprecated for a while and there's an (ongoing) effort to remove them from the code base, e.g. the example you give has been removed already: https://github.com/mozilla/rust/blob/incoming/src/librustc/m... (along with most of the modes from the whole source tree, a big patch landed just a few days ago).

(Also, the master branch is not the one to be looking at for the latest changes at the moment: patches are merged into 'incoming', and master hasn't been updated for more than a month.)


+foo is an old deprecated feature called a mode that is finally just about to be removed. Because the compiler is written in rust, it can take some time for deprecated things to be fully removed from the language.

Modes were supposed to give hints to the compiler whether or not to implicitly copy or move a value into a function, but it was buggy and confusing. So we replaced it with always moving for unique types, and always copying for reference counted types.


> Also, is anyone using Rust in non-toy projects?

Since it's not production ready yet: no


You should double-check what kind of projects are being worked on before saying that it isn't being used for non-toy projects :) I can list at least two off the top of my head:

Q^3, which can render Quake 3 maps and will eventually be its own game: https://github.com/Jeaye/q3

Servo, an experimental web browser being written by Mozilla: https://github.com/mozilla/servo


For me, a non-toy project is a project that runs in production, where I can build my business on.


I love rust, but we have not yet finalized the syntax and the semantics yet, so it'd be risky to write mission critical things in it. Our plan is to hit 1.0 by the end of the year.

That said, rust has been written in rust, and every commit is tested against our test suite on Linux, OS X, BSD, and Windows. So while the language itself may be changing, any code you write in it at a given point in time should work. It'll just take some (small) effort to keep that code in sync with the compiler.

So if you are able to handle that risk, we'd love to have you try it out. It'd really help us find the warts in the language/stdlib before we lock in 1.0.


Rust isn't there yet in my opinion. The syntax and semantics are still undergoing development, and the standard library is still in the process of definition.

If you want to rewrite your codebase on a quarterly to cope with the changes, that's up to you, but I wouldn't.

I'm waiting for 1.0 to really start writing code in it.


There is also a Famicom/NES emulator written in rust: https://github.com/pcwalton/sprocketnes


EventMachine helps with performance critical Ruby code


You're right that EventMachine helps when you're dealing with IO-limitations (like those commonly found in web applications), but for CPU-limited functions like the ones that you see in programming competitions, it's not going to provide much of a benefit.


It wouldn't have helped in this case.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: