News for hackers. Stuff that matters.
Re:Consider the Nimrod Programming Language by jmgrosen on Wednesday March 12, 2014 @06:50PM (#7388956)
I think the reason I don't like Nimrod is the same as the reason I don't like C++(11): it has too many features. Rust's (relative) simplicity and memory safety make it much more attractive to me.
Re:Consider the Nimrod Programming Language by barchar on Wednesday March 12, 2014 @07:56PM (#7389235)
I like nimrod because it has a sane syntax. I can write a function declaration in one line of nimrod that would be 6 lines of c++. I also like Nimrod's focus on static dispatch and easy to use generics.

Rust makes me uneasy because the whole lifetime tracking adds a lot of complexity and I fear it may make some programs harder to write or some libraries harder to use. Also I think that garbage collection, if fast (which nimrod's is very much so) is the right way to go in some situations. I don't actually want to go and spend time freeing a bunch of strings right after I use them.

Re:Consider the Nimrod Programming Language by pcwalton on Wednesday March 12, 2014 @09:09PM (#7389526)
> Also I think that garbage collection, if fast (which nimrod's is very much so) is the right way to go in some situations.

Definitely in some situations garbage collection is the right thing. But Nimrod's garbage collector is not thread safe...

> I don't actually want to go and spend time freeing a bunch of strings right after I use them.

That isn't how Rust works. The compiler automatically frees things via RAII.

Re:Consider the Nimrod Programming Language by barchar on Wednesday March 12, 2014 @09:37PM (#7389616)
RAII is sorta by definition immediate. They are freed right when they exit scope, this can be annoying for large tree structures.

Yeah the GC not being thread safe can be annoying. CSP works OK and if you need more performance a thread safe GC may not be fast enough anyway. If rust can pull off ownership tracking between threads in an easy-to-use way then I would be super excited.

Re:Consider the Nimrod Programming Language by pcwalton on Wednesday March 12, 2014 @11:49PM (#7389955)
Well, you don't have to free in your destructor eagerly: you could incrementally release if you wanted to, and still use RAII. But you're right of course that RAII makes it simplest to eagerly deallocate.

Eager deallocation is usually what you want anyway, because of its cache effects and because you can just release the memory back to the free list (or the OS) and forget about it. If you repeatedly allocate and deallocate a similarly sized block, for example, eager deallocation means that your block will stay in L1 if it fits.

Re:Consider the Nimrod Programming Language by TylerE on Wednesday March 12, 2014 @09:48PM (#7389651)
Um, what are you talking about.

There's a separate heap per thread and data sharing among threads ins't allowed. It's perfectly thread safe.

Re:Consider the Nimrod Programming Language by pcwalton on Wednesday March 12, 2014 @11:34PM (#7389919)
The language doesn't enforce that GC'd pointers don't pass between threads. The GC can silently free stuff you didn't want freed if you pass objects between threads. This is not a property of a thread-safe GC.
Re:Consider the Nimrod Programming Language by TylerE on Thursday March 13, 2014 @10:07AM (#7391836)
Yes, but in practice practically everything in Nimrod is a value, not a ref, so GC'd pointers are an extremely rare duck.
Re:Consider the Nimrod Programming Language by steveklabnik on Wednesday March 12, 2014 @08:05PM (#7389285)
Ultimately though, if you don't have GC, you _must_ deal with lifetimes, wheather or not the compiler helps you with them.
Re:Consider the Nimrod Programming Language by barchar on Wednesday March 12, 2014 @08:59PM (#7389496)
well yes. This is true. But nimrod has (very fast) GC. And it also has destructors and RAII so if you really, really need unique_ptr style memory management you can do that. Rust has lifetime tracking but I would be interested to know how it performs against Nimrod's GC when the ownership gets really tricky.
Re:Consider the Nimrod Programming Language by sanxiyn on Wednesday March 12, 2014 @10:55PM (#7389831)
I think one issue is that people have different opinions on whether "ownership gets really tricky" is a common case or an edge case. Many people with unique_ptr experience seem to assume that Rust's owned pointer is more of the same and not really applicable when ownership is even slightly complex, but this is not the case. Rust's owned pointer is vastly more powerful than unique_ptr and in my experience (and in Rust compiler and Servo browser's experience) and "ownership gets really tricky" is an edge case.
Re:Consider the Nimrod Programming Language by pcwalton on Wednesday March 12, 2014 @09:12PM (#7389537)
> Rust has lifetime tracking but I would be interested to know how it performs against Nimrod's GC when the ownership gets really tricky.

You can use GC or reference counting in Rust—the same that Nimrod uses. (You could use DRC like Nimrod in Rust if you wanted, but it's not my preferred form of memory management due to the cost of making it thread safe.)

Re:Consider the Nimrod Programming Language by andreasvc on Wednesday March 12, 2014 @07:04PM (#7389033)
I think Rust is very interesting, but a language with a "periodic table of types" is definitely not one of the simpler languages out there. Just like the zero-cost abstractions of C++, the memory safety in Rust comes at a price of increased complexity.
Re:Consider the Nimrod Programming Language by andolanra on Wednesday March 12, 2014 @07:43PM (#7389187)
I'd assert that the "periodic table of types"[^1] radically overstates the complexity of the Rust type system, largely because of the rampant misuse of the "periodic table" as a means of presenting groups of things. A "periodic table" of (for example) food items or Perl operators tends to have a bunch of distinct elements in its cells arranged by loose groupings[^2], whereas the Rust periodic table (like the periodic table of elements, but unlike other pop-culture periodic tables) has cells whose contents are for the most part[^3] a function of their row and column.

Tabular nomenclature aside: Rust has values and two kinds of pointers, and a handful of built-in types, and you can have pointers to those types. While the semantics of the pointers are unusual, I don't think that makes it that much more complicated. It should also be noted that many of the proposed language changes make said table even more regular (e.g. replacing the [T] syntactic sugar for vectors with a more conventional Vec<T>.)

Rust is in some ways complicated, and I'll grant that a beginner to the language will likely curse the borrow-checker more than a few times. But I don't think Rust is nearly as complicated as it is sometimes reputed to be.

[^1]: http://cosmic.mearie.org/2014/01/periodic-table-of-rust-type...

[^2]: http://www.ozonehouse.com/mark/periodic/ is an egregious example.

[^3]: There are exceptions (e.g. the closure types) but they are few and easily memorized.

Re:Consider the Nimrod Programming Language by burntsushi on Wednesday March 12, 2014 @08:09PM (#7389310)
As someone without experience with linear types who learned Rust in the last week while porting quickcheck, I think my experience supports your claim here. In the first few days I was cursing the borrow-checker in every way imaginable. I was comfortable with everything except the pointer types and their borrowing semantics.

After a few days, the borrowing logic really started to click and I was fighting much less with the compiler. Admittedly, I still have some fogginess about some areas (particularly the borrowing/sending semantics of closures), but I understand that there's still some work left to be done on that before 1.0. But the point I want to stress here is that once the borrowing logic clicked, Rust became a reasonably simple language. Which is really important to me.

But, I now get to say that I just wrote quickcheck without manually freeing memory and without the use of a garbage collector. That's pretty damn cool if I say so myself.

Re:Consider the Nimrod Programming Language by sanderjd on Wednesday March 12, 2014 @10:00PM (#7389683)
Hey I think I was just playing with your quickcheck library and gave it a star earlier today! Small world. Nice project, I'm looking forward to using it for stuff :)
Re:Consider the Nimrod Programming Language by burntsushi on Wednesday March 12, 2014 @10:03PM (#7389689)
Ah great! Thanks :-) Feedback/criticism is appreciated. Still kind of learning the ropes of the Rust ecosystem.