6 ms·
Unsurprisingly, I disagree with most of this post. * The part about Rust having no shared memory is just wrong. Rust has a very rich set of concurrency primiti
by pcwalton 13y ago
Unsurprisingly, I disagree with most of this post.
* The part about Rust having no shared memory is just wrong. Rust has a very rich set of concurrency primitives at this point: you can use immutable shared memory (Arc), mutexes (MutexArc), reader-writer locks (RWarc), and atomic variables (AtomicInt and friends). And if you're willing to drop down to unsafe code, you get the full set of LLVM concurrency primitives.
* The complaint about smart dereferencing strikes me as odd. Almost every new systems language—Objective-C, D, Go, and Rust (and also Nimrod I think?)—does the same thing that Rust does in that the "." operator also works on pointers. It's type-directed: if you don't know whether you're working with a pointer or not, just go look at the type of the value you're working with. If you don't know a value's type, then you have much bigger problems than knowing whether you'll get an extra memory access on ".".
Hiding the difference between a memory access and a cheaper operation is something compilers have done ever since the invention of register allocation.
* I don't know what the complaint about "bugs with small objects" is, but all word-sized objects were made into LLVM Values a while back, making us as efficient there as you can be. Unless I'm misunderstanding the complaint.
* Doing code duplication to accommodate different types of smart pointers doesn't work. The smart pointers have different semantics: that's why they exist in the first place. You can't just copy and paste your code.
* The GC in Rust does need work. But so does C++'s GC and nobody is saying "C++ is not fast" because of it.
About the only part I agree with is is "fork-join parallelism and work-stealing should be better supported". This is an area we'll need to flesh out more fully at some point. Note that there is now a much more advanced work-stealing scheduler. (It's not using the most efficient data structures for work stealing yet though.)
- tete 13y agoA few small addendum: * Objective-C is from 1983, do you? It's not exactly new. ;) * Nimrod is pretty fast and as the only language even supports soft-realtime applications out of the box. Besides that it feels the nicest to use and has a fat standard library with stuff like Redis. Sorry, I only played with that language, but already feel like a fanboy * About GC. Yes, that's a problem of all newer languages, but whatever implementation you choose there are advantages and disadvantages and which one is the right one also depends a lot on the language itself. Sometimes you are better off with your big fancy algorithm and sometimes you really just want good old reference counting. But yeah, GC is the big great topic and I am sure it will be for the next few decades.
- taumhn 13y ago> Objective-C is from 1983, do you? It's not exactly new The dot-syntax for accessing object properties is much more recent though (2009?).
- mikeash 13y agoIt's a pretty unimportant feature though. It's just some very minor syntactic sugar for a regular message send. All uses of obj.property can be replaced with either [obj property] or [obj setProperty:...] depending on whether it's being written or read. It's about as significant as when C added the ability to declare variables in the middle of a block or support for // style comments i.e. not at all.
- gress 13y agoFor now perhaps, but it does seem as though properties are gradually being lifted into a first class language feature rather than a set of conventions.
- mikeash 13y agoProperties are, but dot syntax is almost entirely not about properties.
- gress 13y agoI'm not sure I understand what you mean by that. Dot syntax is a way to refer to properties independent of the usual message sending syntax. How can it not be about properties?
- mikeash 13y agoBecause... it's not? Declare a plain getter method: -(id)foo; Call it with dot syntax: id foo = obj.foo; Works fine. Now declare it as a property: @property id foo; Call it without dot syntax: id foo = [obj foo]; Works fine. They are completely unrelated and just introduced at the same time. You could take dot syntax out of the language without affecting properties in the least. You could take properties out of the language without affecting dot syntax in the least. (There is one exception to this, and that is the part where dot syntax understands and calls custom getter/setter names for properties. But that is the only place where they even touch, and it certainly doesn't mean they're somehow integrated.)
- richardwhiuk 13y ago> The GC in Rust does need work. But so does C++'s GC and nobody is saying "C++ is not fast" because of it. C++ doesn't have a garbage collector, so I'm not sure what you are getting at here.
- widdershins 13y agoHe may be referring to shared_ptr, which implements reference-counted garbage collection in the standard library.
- kibwen 13y agoSure it does, here's one: http://www.hpl.hp.com/personal/Hans_Boehm/gc/ http://www.hpl.hp.com/personal/Hans_Boehm/gc/ Rust has a GC in the same sense that C++ has one, which is to say that its GC can be provided by libraries rather than being baked-in to the language.