News for hackers. Stuff that matters.
Re:Systems Languages: An Experience Report by staticassertion on Friday July 06, 2018 @02:57PM (#17474181)
I write web services in Rust.

I'm extremely productive in Rust vs other languages, especially for young projects where I spend a lot of time refactoring. Things like borrow checker errors just don't happen very often to me anymore, or they catch legitimate bugs and are generally quite easy to fix. I just don't run into them very often at this point.

I've written Python and Java professionally. In both cases I felt like I just couldn't express what I wanted to, at all times, in my program. This led to me being a lot less comfortable refactoring - relying on tests that were far too heavily tied to implementation details.

I had some really complex logic I needed to write for one of my services. Basically I needed to represent a 'thing' and that 'thing' could be in a few different states. I wrote out the code, types first, so that every state had a type. I was able to do this generically using Rust's associated types in a way that allowed me to implement the state machine for multiple 'things'. It was very testable, very readable code that I had high confidence in. I would have had a much harder time doing this in Java/ Python (I have done similar things, and you can get value from the approach, but not the same level). I've refactored that code a lot with confidence.

Speed is a nice bonus, but mostly secondary.

Re:Systems Languages: An Experience Report by kbenson on Friday July 06, 2018 @03:10PM (#17474258)
Can I ask what you use as a database abstraction layer, if any, and what methods you use to convert your request params/JSON to queries?

I was playing around with trying to do this a while back (while also trying to learn Rust some), and it felt very cumbersome to have to write many specific Diesel update methods to handle different types of requests. It could have been my now knowing a better way to accomplish it, or it could have been the type of queries I was trying to model aren't a good fit for a staticly typed system like that (and there may be a better way to architect it). In any case, it felt like I was poorly approximating the strict typing I had already implemented in Postgres, a few times over, when I would be happy just handing it to Postgres and letting it throw out errors as needed.

Re:Systems Languages: An Experience Report by staticassertion on Friday July 06, 2018 @04:11PM (#17474735)
The only data stores I currently use are redis and dgraph. I write raw dgraph queries, though I have a small, highly focused library that I use to generate some of them.

As for redis, I use it as a dumb KV store, no need for an abstraction layer.

Re:Systems Languages: An Experience Report by lazharichir on Saturday July 07, 2018 @05:06AM (#17477753)
Dgraph is awesome but lacking some serious basic features such as backups and automatic file format update on new versions. I hate to export it all, update, re-import...

But love it, and love the team at Dgraph/Badger.

Re:Systems Languages: An Experience Report by staticassertion on Saturday July 07, 2018 @11:55AM (#17479039)
Yes, it's young and that shows in some places. But I think the team has done an excellent job and it happens to fit my use case very well.
Re:Systems Languages: An Experience Report by Koshkin on Friday July 06, 2018 @03:56PM (#17474607)
> I'm extremely productive > I spend a lot of time refactoring

Isn't that a contradiction?

Re:Systems Languages: An Experience Report by staticassertion on Friday July 06, 2018 @04:10PM (#17474729)
No.

I would be refactoring in any language - the idea behind the service, the requirements, etc, are changing a lot as I'm building these services out. These are external factors that would exist regardless of the language, as I continue to explore the problem space.

Re:Systems Languages: An Experience Report by sargun on Friday July 06, 2018 @06:47PM (#17475706)
Have you written Erlang?
Re:Systems Languages: An Experience Report by staticassertion on Friday July 06, 2018 @08:34PM (#17476166)
Not anything serious, no. I'm decently familiar with it though - I'm fascinated by the actor model, and have read a decent portion of Joe Armstrong's thesis.