News for hackers. Stuff that matters.
Re:Why does the C preprocessor interpret the word “linux” as... by simias on Wednesday October 09, 2013 @12:23PM (#6522208)
Ah! That's great, I didn't know that. The more I hear about rust the more I like it. But then I'm reminded that it bakes garbage collection into the core language...

Oh well, perfection is no of this world.

Re:Why does the C preprocessor interpret the word “linux” as... by pcwalton on Wednesday October 09, 2013 @12:56PM (#6522386)
GC is being removed from the core language and will migrate to a library before 1.0.
Re:Why does the C preprocessor interpret the word “linux” as... by adrusi on Wednesday October 09, 2013 @12:48PM (#6522329)
There's a project, zero.rs, that lets you have no runtime in rust. It's been shown that it's possible to make a simple kernel with it without too much pain. The disadvantage, of course, is that libraries will use garbage collection, and as soon as it's used, you get the runtime, so you can only use certain libraries designed for zero.rs, which causes fragmentation.

All this would happen if gc was in the std library anyway though.

Re:Why does the C preprocessor interpret the word “linux” as... by pcwalton on Wednesday October 09, 2013 @12:56PM (#6522382)
Rust libraries rarely use GC. The standard library goes out of its way to avoid it wherever possible, while remaining safe.
Re:Why does the C preprocessor interpret the word “linux” as... by simias on Wednesday October 09, 2013 @12:54PM (#6522370)
Fair enough. I just have to cross my fingers and hope the GC won't catch on then! :)
Re:Why does the C preprocessor interpret the word “linux” as... by kibwen on Wednesday October 09, 2013 @05:17PM (#6523938)
We strive to avoid GC like the plague in the stdlib, and the language itself encourages users to do the same. I wouldn't go so far as to say that we try to make it hard to use GC in Rust, but we definitely believe that it's currently too easy to resort to it over better alternatives. This is why we're moving it into a library.
Re:Why does the C preprocessor interpret the word “linux” as... by Serow225 on Thursday October 10, 2013 @12:48PM (#6528676)
As a thought experiment, what would happen if the GC was removed altogether? What consequences would that have (good and bad)?
Re:Why does the C preprocessor interpret the word “linux” as... by kibwen on Thursday October 10, 2013 @04:13PM (#6529764)
No thought experiment necessary, you can do this today in two ways:

1) We have an attribute that you can stick in a module that will throw an error at compile time if a managed pointer gets used anywhere in that module, including in its dependencies. (Note: this is still experimental, and I'm not sure if it actually works yet.)

2) It's possible to write Rust entirely without a runtime, which means your result binary just plain won't contain any of the machinery for GC, tasks, or TLS (task-local storage).

This second approach does have consequences. Bad: random bits of the standard lib won't be usable, since our preferred means of error handling uses TLS (and some functional/persistent datastructures will use GC to handle cyclical pointers, since that's our only internally acceptable use case for GC). We have plans to look at dividing the stdlib into "usage profiles" to allow users to selectively disable certain runtime features while still remaining aware of exactly which pieces of the stdlib are still usable.

But the good consequences of disabling the runtime are that if your code exposes a C ABI, then you can write a library that can be called from any other language with a C FFI (i.e. basically every language, ever). This is actually one of my favorite things about Rust.

Re:Why does the C preprocessor interpret the word “linux” as... by agscala on Wednesday October 09, 2013 @01:35PM (#6522615)
What's wrong with garbage collection being built into the language?
Re:Why does the C preprocessor interpret the word “linux” as... by Symmetry on Wednesday October 09, 2013 @02:14PM (#6522840)
Nothing if you're writing your whole application in Rust. If you're making libraries or a kernel, though, it starts to present problems.
Re:Why does the C preprocessor interpret the word “linux” as... by eropple on Wednesday October 09, 2013 @01:46PM (#6522675)
Performance. Rust is able to provide its desired expressiveness without forcing you to make that tradeoff every time you use it.