gray 🌄 Profile picture
Sep 15, 2020 9 tweets 2 min read Read on X
Musings about developing in Rust:

When people start in Rust, they often get into 'fights' with the borrow checker. This can be a source of much frustration, especially for experienced devs who try to use patterns they know from other languages which give them lots of headaches.
This can give off the impression that in order to dev in Rust you need to do overly complex lifetime annotation and/or runtime borrow checking in order to satisfy borrowck.

However, as you get more experienced with Rust, you start to notice that this is not really true at all.
Instead, you realize is that getting into 'fights' with the borrow checker is actually a *symptom* of a deeper problem of ambiguous data ownership in your program.

This is really interesting because it can give you an early forecast of deeper issues on the horizon!
If borrowck is making your life hard, even early on in a project, it's a pretty good sign that *you need to reevaluate data ownership in your code*.

I think this is something that experienced Rust devs sort of do without even realizing it; they've discovered over time that >
fighting borrowck almost never leads to good things, and so they sort of instinctively change things around when they see the first signs of trouble.

And, I think it's really interesting to get this emergent behavior: borrowck was never really designed to be prescriptive, afaik!
Just to clarify what I meant by this last point:

borrowck is designed to check the *correctness* of your code *implementation*, but it was never really meant to be able to tell you whether your overall program *design*/structure is good or not....
And I think it's really interesting that, in practice, the first thing seems to in some way imply the second as well.
An interesting addendum to this, as discussed here

oftentimes, the way borrowck pushes you is not the *only* correct way to do things! perhaps your original idea was actually valid, and it just couldn't be verified b/c borrowck is not smart enough...
Interestingly, the fact that borrowck isn't as smart as a human can be is often a good thing! It means that once you come up with a way to express what you want to do in a way that borrowck understands, it'll be simple enough that a human can more easily verify & work on it too!

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with gray 🌄

gray 🌄 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @fu5ha

Oct 9, 2020
Alright time to hop on my soapbox real quick.

Graphics friends: we *really* need to do a better job of talking about color. Right now color science is basically a dark art that never actually gets taught by graphics learning resources unless you seek it out specifically.
Because of this, so many new to intermediate level people (and perhaps even very advanced people if they never needed it for their specific discipline) have basically no idea about color beyond “linear vs srgb”... and they don’t actually understand linear vs srgb either!
“Linear vs sRGB” being such a standard colloquial dichotomy is an example of exactly the issue I’m talking about because it’s used as a simplification to teach to newcomers, but until you have a deep understanding of color science you don’t actually understand what it means!
Read 6 tweets
Jul 15, 2020
Art Tips from a Graphics Programmer 1, FRESNEL!

This funny word is responsible for creating many of those sweet, sweet rim lighting effects we know & love. Understanding it will really help you up to the believability & pop factor of your rendering & lighting!

(THREAD)
The Fresnel effect is actually very simple at its core, and is one of the basic principles of how *ANY* object is lit.

The basic idea is this: the greater the ANGLE of reflection of a ray of light off a surface, the more energy (brightness) that ray will carry!
So, let's explore that image above a little more. We have a light shining onto a surface which reflects the light back at several different angles. Depending on how glossy the surface is, some directions will have more or less rays, and some will end up at the viewer.
Read 17 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


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

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

Become Premium

Don't want to be a Premium member but still want to support us?

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

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(