Discover and read the best of Twitter Threads about #rustlang

Most recents (3)

So @steveklabnik posted a really thoughtful piece on open source and free software (read it if you haven't: words.steveklabnik.com/what-comes-aft…), and the responses on places like Hacker News made an error that seems common in these circles: believing working harder will solve a problem. 1/12
This comes up with people defending C, who argue "people should write better C." Of course, this is nonsense. If a person can write better C consistently, we should assume they will. If a person can, with extreme focus, write better C, that doesn't mean they can sustain it. 2/12
It comes up with free software too. When someone points out the failures of the free software movement, the response is "more people should believe in free software, THEN we can deliver our goals." This is nonsense. You don't get more adherents by demanding more adherents. 3/12
Read 12 tweets
Spending the weekend rewriting some early Rust projects and OMG some of this error handling is cringy. I've learned a lot about error handling in #rustlang since:
match & if let statements are easily nested into infinity - this style puts the "successful path" first, but its hard to debug and folks coming from other langs will curse you.
A lot of matches with if/else nesting can be eliminated with match guards -- easy to forget they exist, but they are much more concise.
Read 8 tweets
Small thread about a #rustlang #libp2p design mistake I made.

When you write, for example an HTTP server, each connection is handled on its own, and all of them are handled concurrently.

If multiple connections need mutable access to something, you lock a mutex.
Using a mutex is not a problem, because you don't care in which order requests in multiple different connections are being handled, and therefore you don't care whether connection A locks the mutex first or connection B.

But in a peer to peer environment, it's different.
In peer to peer systems, you want to handle the network as a whole. When you receive a pubsub message from a node, you want to relay it to the others.
When you receive a peer discovery query, you need to return the nodes you're connected to, and so on.
Read 11 tweets

Related hashtags

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!