I'm a very experienced software developer and manager (I wrote my first line of code in 1960 in college!). I'm retired now, but still do a lot of software development for my own use. My primary focus is a suite of personal finance programs that I wrote mostly for myself, but have shared on github. The main program and several utilities are written in C; other smaller utilities in Tcl. The data is stored in a sqlite database. The gui was done with gtk3.
I do have a particular interest in programming languages and have used an awful lot of them over my long career. In recent years, I've written a fair amount of Haskell code and more recently, some Go and Rust code. I'd like to re-write the C components of my finance suite in something more modern, so am evaluating languages for that purpose. I've re-written the smallest of them in Haskell, Go and Rust as exercises in those languages. I've also done a similar exercise with Chez Scheme. That system is excellent -- solid and very fast -- but I've really become sold on static typing. I've had debugging sessions with Scheme code that were much too long and involved errors that would have been caught at compile-time in a statically typed environment.
I think Haskell is very interesting, something to which we should all have some exposure. But to get anything real done, you end up writing a lot of imperative code and it isn't a good vehicle for that.
Go is fine, well done, but pretty uninteresting as a language, and its performance, at least in bench-marking exercises, has not always been stellar. It's probably fine for my purposes, but I'd like to have some fun, too, and Go is awfully ho-hum.
Rust. Now there's an interesting case. I've spent too much time trying to wrestle it to the ground and have, finally, produced working code with it. But if you need global state for any reason -- e.g., hash-tables, switches, etc. -- I wish you a lot of luck. Trying to pass around a mutable global structure gets you into lifetime hell. Statics, particularly if they are mutable, are almost impossible to use, partly because the damned thing insists on imposing thread-safety upon you, even if your application is inherently single-threaded. Also statics can only be initialized with things that can be computed at compile time. Yes, there's lazy_satic and a thread-local thing, but I ran into road-blocks there, too. Basically, if you like wearing a hair-shirt while writing code and like fighting with your tools, Rust is just the thing for you. Did I mention that the documentation is awful? At this point, the only reason I can see for using Rust is if you have a situation that really can't tolerate garbage collection in any form. I can imagine situations where the pauses due to mark-sweep could be an issue, but reference counting? I wonder if this is a solution in search of a problem. I certainly don't think Rust is a sensible choice for most applications.
Reading slashdot recently brought nim to my attention. I'd never heard of it, but what I read suggested that I ought to have a look. I have done that and have re-written my smallest C utility in nim and have gotten it working (I do my work on Arch Linux systems and one machine running DragonFly BSD). So far, I'm very impressed. The language is nicely designed, a very sensible amalgam of good things from places like Python. The performance seems good, though what I've written thus far is not demanding in that regard. What has impressed me most is the speed of my work and the readability of the code. Developing in nim thus far has been comparable to Go and the opposite end of the scale from Rust in terms of productivity and frustration level. The code reads very much like Python and that's a good thing, especially when you consider that you have the added advantage of the performance of compiled code and the debugging advantage of static typing.
So I just wanted to drop a note and pay a compliment for what appears to be very good work. Hopefully I won't run into any show-stoppers, but so far, so good.
Hello,
Interesting, I am also am a Rust user, and I have looked into, but not used Go. I happen to love Rust as well as Nim, but I totally am in agreement that Nim is amazingly productive :)
Let us know if you have any questions. Mine have always been answered in a day flat, and most of all, Welcome to the community -- it's great to have friendly, experienced people like you! :D
Interesting, I am also am a Rust user
Interesting. I have not find time yet to learn Rust -- I intend it, but currently better learning modern C++ has priority for me, as I may need it for job.
How difficult is converting Rust code to Nim? Reason for this question is, that I would be interested in some "incremental constrained delaunay triangulation" (2d only) in native Nim. Coding that from scratch in high quality (numerical stable and fast) following papers is a big effort of course, so I consider converting C++ or Rust code to Nim. For C++ code I have not yet found really nice sources -- CGAL lib of course contains it, but it may be hard to extract. For Rust I recently saw https://github.com/Stoeoef/spade which seems to be not bad and is MIT licensed. So I consider learning some Rust next winter and maybe convert it to Nim.
++
struct NeedsStringRef<'a> {
reference: &'a String,
}
impl<'a> NeedsStringRef<'a> {
fn new(reference: &'a String) -> NeedsStringRef<'a> {
NeedsStringRef {
reference
}
}
}
fn main() {
let my_string = String::from("Hi!");
let uses_ref = NeedsStringRef::new(&my_string);
}
type
NeedsStringRef = object
reference: string
proc newNeedsStringRef(str: string): NeedsStringRef =
result = NeedsStringRef(reference: str)
let s = "Hi!"
let ns = newNeedsStringRef(s)
These differences are enough to make coding the same algorithm in the two languages similar, but not similar and idiomatic.
Interesting, I am also am a Rust user. (...) Nim is amazingly productive.
I prefer Rust for more complex projects but heretically use Nim for reusable scripts (interchangeably with Python). :D
I prefer Rust
Writing this statement without explaining WHY makes not much sense and this thread was not really about a poll about what language we prefer ;-)
Of course most of us know some advantages of Rust, like more available packages and more fulltime devs, so less risk when some of them vanish. But we also know disadvantages of Rust including more boilerplate, which makes it more difficult and slow to write and read. Just recently I saw this post: https://z0ltan.wordpress.com/2017/02/21/goodbye-rust-and-hello-d/