Eric Fredine Profile Banner
Eric Fredine Profile
Eric Fredine

@fredine

457
Followers
2,534
Following
36
Media
3,576
Statuses

Principal engineer writing code for fun and profit. Lapsed photographer. Husband. Father. Aspiring fly fisher.

Vancouver, British Columbia
Joined July 2008
Don't wanna be here? Send us removal request.
@fredine
Eric Fredine
1 month
In Rust there's a very elegant solution:
Tweet media one
@ozanyrc
Ozan Yarcı
1 month
This code structure is called an arrow anti-pattern. How to fix this code?
Tweet media one
656
143
2K
76
83
2K
@fredine
Eric Fredine
1 month
Rust is doing this correctly. It’s better to model things as they are rather than requiring a bunch of implicit knowledge. The simplicity of C is dangerously misleading.
@0xglitchbyte
Glitchbyte
1 month
How hard can strings be? /s
Tweet media one
107
217
3K
54
109
2K
@fredine
Eric Fredine
1 month
I think I’m now at a point where I’m more productive in Rust than TypeScript or PHP because I spend almost no time debugging. An expressive type system and pattern matching is a game changer. If it compiles it works.
27
21
413
@fredine
Eric Fredine
4 months
Rust has a fear problem. I semi-seriously implied to someone that they could re-write their Typescript lambdas in Rust and save a bunch of money. They were terrified that it would be impossible to find people capable of doing it.
19
5
127
@fredine
Eric Fredine
1 month
Mind you, I think the score is more likely to be a float, so then you need to do something like this
Tweet media one
10
0
119
@fredine
Eric Fredine
1 month
Or you could go all in and define grade as its own type:
Tweet media one
10
0
96
@fredine
Eric Fredine
1 month
@tem_dev This obscures the business logic and makes it hard to reason about correctness. I assume you’re doing this because you think it’s more efficient. But that’s usually far less important than clarity. And it’s not even obvious to me it would be faster.
1
0
81
@fredine
Eric Fredine
1 month
@o__boga I mean sure - but it’s gross
2
0
73
@fredine
Eric Fredine
3 months
@kiyov09 The advantage of starting with C is that it hides much less of the machinery and is a relatively simple language. The effort required to accomplish things might be a bit terrifying!
4
1
67
@fredine
Eric Fredine
3 months
Rather than “you should learn C before learning Rust” how about “I found having some knowledge of C useful when I was learning Rust.” People understandably dislike being told they SHOULD do something but often appreciate hearing about experiences.
11
2
54
@fredine
Eric Fredine
1 month
@sean_j_roberts I think so - if you don’t want to do an allocation and return an owned string. But I’m still a bit hazy on this myself.
2
0
52
@fredine
Eric Fredine
4 months
@GeorgeMayer Trust really is the foundation needed to accomplish so many things. I think its importance is often under appreciated. Whenever I see some sort of dysfunction I often try to start by first considering what trust issues might be involved.
1
0
52
@fredine
Eric Fredine
1 month
@aleh_loup Agreed - but it’s nice to have the specialized types when you really need them.
0
0
49
@fredine
Eric Fredine
4 months
The One Billion Row Challenge looks like a great one: write a Java program for retrieving temperature measurement values from a text file and calculating min, mean, and max temperature per weather station. The file has 1,000,000,000 rows!
1
4
49
@fredine
Eric Fredine
2 months
Is there any practical reason to learn assembly today unless you’re working on a compiler and need to emit the assembly code? I mean other than very specialized cases like writing a video codec?
58
0
46
@fredine
Eric Fredine
3 months
@glcst @iavins Haven’t written C in 30 years and I can still feel that instinct.
1
0
43
@fredine
Eric Fredine
4 months
Core databases like Postgres are typically written in C or C++. The tools emerging from the big data era - Lucene, Spark, Presto/Trino… are all on the JVM (Java, Scala). Now there’s a new generation written in Rust: Arrow, DataFusion, Tantivity… We live in interesting times!
6
1
43
@fredine
Eric Fredine
2 months
I had to use a mutex in Rust today. It’s getting real now.
7
1
41
@fredine
Eric Fredine
1 month
@elucentdev Examples of better?
7
0
41
@fredine
Eric Fredine
1 month
@tem_dev Ha ha - yes - so much better. You have could have a bright future in Java frameworks.
1
0
35
@fredine
Eric Fredine
3 months
I've been playing around with different ways of implementing binary trees in Rust. It's one of those things that seems to be treated as a black art but that seems unwarranted. This is a simple one just using Box.
Tweet media one
3
0
36
@fredine
Eric Fredine
1 month
@jamonholmgren I think people are falling into the “it doesn’t always work and sometimes does dumb things so I’m not going to use it all” trap. Or perhaps the even worse trap: “I can’t imagine how it could work so I’m not going to try it.” Or the worst trap: “I read that it doesn’t work.”
3
0
33
@fredine
Eric Fredine
14 days
I’ve been reading documentation for async Rust and Tokio. I think some of the negative sentiment around async Rust might be over blown.
9
2
33
@fredine
Eric Fredine
8 months
@Grady_Booch Still included in my sons introductory CS class
1
0
30
@fredine
Eric Fredine
2 months
Even when you write Rust code that is hilariously inefficient because you don’t know what you’re doing it ends up being more than fast enough.
2
3
28
@fredine
Eric Fredine
2 months
I’m using Rust as a faster Python, That’s the explicit goal of Mojo. But it seems like it still has a ways to go until it’s ready for real world use?
13
0
28
@fredine
Eric Fredine
3 months
@thdxr And then pay 100,000$
1
0
27
@fredine
Eric Fredine
1 month
Rust can be verbose. The types compose well but you often have nested types like Result<Option<T>,E> and then have to return a result with Ok(Some(thing)). It’s taken me a while to get used to that.
4
0
24
@fredine
Eric Fredine
4 months
I think the database per customer approach to multi-tenancy is a good one and agree that SQLite becomes a reasonable choice. We live in interesting times.
@dhh
DHH
4 months
"I for one am terribly excited about what conceptual compressions might lie just around the corner, if single-tenancy at scale pans out as a strategy. Let’s go find out!"
30
36
382
2
5
24
@fredine
Eric Fredine
2 months
I can confirm that as my fluency with Rust improves memory management and the borrow checker has receded into the background. And lifetimes hardly ever come up.
2
4
22
@fredine
Eric Fredine
1 month
@lemire I’m challenging your claim. I find them useful and widely applicable in Rust. So perhaps it does depend on how they are implemented?
0
0
23
@fredine
Eric Fredine
1 month
There seem to be a lot of people identifying as C programmers who don’t understand character encodings?
1
0
23
@fredine
Eric Fredine
3 months
@amasad You don’t question his judgement?
3
0
20
@fredine
Eric Fredine
1 month
A lot of people feeling the need to show us how smart they are by mentioning that a compiler won’t save you from math, logic and domain errors. Thank you for your service. There might be someone who doesn’t know this.
@fredine
Eric Fredine
1 month
I think I’m now at a point where I’m more productive in Rust than TypeScript or PHP because I spend almost no time debugging. An expressive type system and pattern matching is a game changer. If it compiles it works.
27
21
413
5
0
21
@fredine
Eric Fredine
3 months
The C and Rust folks are fighting (again?). And some are suggesting that everything would be better if we just had one programming language. And the AI bois are still saying we won’t need any soon enough.
8
2
19
@fredine
Eric Fredine
29 days
Yesterday a few of us were talking about CUDA kernels in PyTorch. This paper introduces the idea of database kernels running on SSD devices. That seems like a very cool idea. Slowly working out some general principles on how kernel is used in computer science.
@eatonphil
Phil Eaton
29 days
This week's paper in the DistSys reading group looks fantastic.
Tweet media one
4
21
195
1
5
19
@fredine
Eric Fredine
1 month
@ILikeDucks01 Don’t think it matters
3
0
19
@fredine
Eric Fredine
2 months
@DrawsMiguel What do you hate about cargo?
0
0
18
@fredine
Eric Fredine
5 months
@JosephJacks_ On the other hand it’s possible that forcing people to create models that learn more efficiently with less data will inspire innovation and accelerate progress. Current techniques might just be the lazy ones made possible only by cheap data.
3
0
18
@fredine
Eric Fredine
2 months
F# seems like an interesting language. I just can’t work up the energy to take on the .net ecosystem. I feel like I can get things done in the JVM world of if I need to and .net just seems similar but different.
6
1
17
@fredine
Eric Fredine
2 months
Error handling in Rust scales well. You can start by YOLO ing it with the ? operator and then add in more sophisticated error handling as it becomes necessary.
4
1
17
@fredine
Eric Fredine
1 month
@RichHHawk Exactly. You are now responsible for interpreting those bytes correctly. I prefer to let a compiler do that for me.
1
0
16
@fredine
Eric Fredine
22 days
@DrawsMiguel @_Felipe Unironically why I’ve developed an interest in compilers. I accidentally built one and realized I didn’t know what I was doing.
1
0
16
@fredine
Eric Fredine
13 days
This sort of attention to detail and care for quality error messages is a Rust super power.
@algo_luca
Luca Palmieri
13 days
Rust 1.78 has just been released! The new diagnostic attribute unlocks *massive* quality of life improvements for day-to-day Rust usage. Library authors finally get access to (some of) the machinery that allows Rust's standard library to emit high quality compiler errors.
Tweet media one
8
71
460
0
1
15
@fredine
Eric Fredine
1 month
I might have a legitimate reason to sneak a little Rust into production.
5
0
14
@fredine
Eric Fredine
18 days
@GeorgeMayer I honestly can’t tell if they are serious or it’s just memes all the way down. All the comments on the post are about the quality of the presentation and nobody discussing the substance.
3
0
14
@fredine
Eric Fredine
1 month
@exhaze In Rust I have deeply nested enums and structs that I can flexibly serialize and deserialize in a type safe way and map to other forms with pattern matching. Typescript unions and switch statements are more limited leading to a lot of “manual” code that is error prone.
2
0
14
@fredine
Eric Fredine
3 months
I was researching using Debezium to replicate Postgres data to Iceberg tables in S3. It’s definitely a thing. Then I wanted to know if it could handle sharded data. I was not finding good answers until I gave Duck Duck Go a try. Nailed it:
0
1
14
@fredine
Eric Fredine
2 months
What’s stopping you from writing assembly code on your Mac?
@fredine
Eric Fredine
2 months
If you have Xcode tools installed building ARM 64 assembly on an Apple Silicon Mac is straight forward. It can be as simple as gcc hello.s -o hello It takes a bit of poking around to get there. Some useful links in the replies.
1
0
3
10
0
14
@fredine
Eric Fredine
2 months
I like that in Rust I can write code that takes a few hours to build up and when it compiles it works.
0
0
13
@fredine
Eric Fredine
1 month
@ewanmakepeace It’s probably the case that the more expressive your type system is the more likely you are to have this experience.
0
0
13
@fredine
Eric Fredine
15 days
@algo_luca The definition in the standard library seems good: More specifically, this is the offset in bytes between successive elements in an array with that item type including alignment padding. Thus, for any type T and length n, [T; n] has a size of n * size_of::<T>().
0
0
13
@fredine
Eric Fredine
4 months
@Lucretiel When you’re sure you need the thing it’s worth being ambitious and doing it right. The lesser thing is only worth considering if it might get thrown away.
1
0
11
@fredine
Eric Fredine
1 month
@lemire I know you’re not a fan but I find iterators very useful in Rust. It’s possible I just haven’t used it enough to encounter the downsides. So if there’s more on iterators in Rust being bad I’d like to learn more.
1
0
12
@fredine
Eric Fredine
1 month
The null, undefined, optional thing in JavaScript and Typescript is the worst programming language design choice of all time. Name one thing that’s worse?
5
1
12
@fredine
Eric Fredine
25 days
Cool - I’ve taken to using copilot for this sort of thing but this is a good trick to know.
@zeddotdev
Zed
25 days
Did you know rust-analyzer can convert JSON into Rust structs? Simply paste your JSON into a Rust file and run the `convert JSON to struct` code action.
27
73
911
0
1
12
@fredine
Eric Fredine
3 months
@AdamRackis I mean - I’d support that rule. Not in a dogmatic fight for my life way but in a the alternative is the way I prefer way. This seems like an easy one to fix too.
2
0
12
@fredine
Eric Fredine
3 months
On the one hand we have people rewriting things in Go, Rust and C++ to make them more computationally efficient, On the other hand we are using generative AI to calculate things in an insanely inefficient way that makes Python look like a Lambo, Someone is confused?
3
1
12
@fredine
Eric Fredine
18 days
If you have high alignment and autonomy you can love cranking code for decades. If either dimension is too low you will burn out.
@jarredsumner
Jarred Sumner
19 days
I feel like it’s rare for engineers with > 5 years of experience to still love writing lots of code
288
18
1K
2
3
12
@fredine
Eric Fredine
28 days
I’ve been writing a lot of Rust so it felt weird writing camel case variables in TypeScript today.
2
0
12
@fredine
Eric Fredine
1 month
@ti_stephen Since 1972 actually
1
0
12
@fredine
Eric Fredine
3 months
I had a legitimate excuse to use Rust at work today. Calculating cosine similarities on some embeddings. Working well so far.
5
0
10
@fredine
Eric Fredine
27 days
@timClicks Totally - completely ridiculous take.
0
0
12
@fredine
Eric Fredine
8 months
@housecor @jsmlDev What do you mean by defining constraints within resolvers?
1
0
12
@fredine
Eric Fredine
1 month
@0xglitchbyte Rust is fine. It’s better to model things as they are rather than requiring a bunch of implicit knowledge.
0
0
11
@fredine
Eric Fredine
3 months
Now that we’re down arguing about C… real programmers start by building a lisp compiler from their own boot-strapped forth implementation. And then use that to build an editor.
4
2
11
@fredine
Eric Fredine
3 months
Somehow learning Rust has led me to start poking around again in C.
@lemire
Daniel Lemire
3 months
C can be memory-safe by @ErrataRob Forking is a foolish idea. The core principle of computer-science is that we need to live with legacy, not abandon it. And there's no need. Modern C compilers already have the ability to be memory-safe, we just need to make minor -- and…
20
29
181
1
0
10
@fredine
Eric Fredine
1 month
LLMs give “mid” solutions which is fine for things you don’t know well or while you’re learning. But for people with a higher level of skill they are just a distraction.
@Lucretiel
Lucretiel 🦀
1 month
For real, like, I’m more than ready to introduce these into my workflow once they WORK RIGHT Which right now they fucking do not
1
1
19
2
0
11
@fredine
Eric Fredine
16 days
You know that feeling when you’ve slowly walked into a cold lake and the water is now up to the sensitive bits and it’s time to just jump in? That’s me and async Rust right now.
0
0
11
@fredine
Eric Fredine
1 month
Post a Picture YOU took. Just a Pic. No description* *Beyond alt text. Always add alt text
Tweet media one
@FelixCLC_
fclc
1 month
Post a Picture YOU took. Just a Pic. No description* *Beyond alt text. Always add alt text
Tweet media one
1
0
8
2
0
11
@fredine
Eric Fredine
3 months
I used to take photographs. This one got used as a classical cd cover. There are forms of generative art that I dabble with sometimes but nothing has stuck so far. I’m kind of a minimalist at heart and they tend to be too busy for me.
Tweet media one
2
0
9
@fredine
Eric Fredine
4 months
Very interesting read on using Rust to solve the #1brc It uses a perfect hash function. The current solution is not quite a general one. But the speed is starting to approach the constraint of RAM bandwidth.
@curious_coding
Ragnar Groot Koerkamp
4 months
Subsecond #1brc is here :) Down to <5s single threaded, and 0.90s on 6 cores! Mostly from processing 4 streams in parallel in each thread, which boosts instructions/cycle from 2.2 to almost 3. Still not quite 4 yet though.
1
7
37
0
1
10
@fredine
Eric Fredine
1 month
@harshad1313 With match the compiler ensures you’ve considered all cases. I think it’s also more self documenting.
1
0
10
@fredine
Eric Fredine
4 months
That feeling when you finally decide to do that refactor you've been putting off and discover that you've laid some good groundwork that's going to make it easier now. Thank you previous version of me.
2
0
9
@fredine
Eric Fredine
1 month
@chiefnoah13 Yeah - bugs of understanding are always big thing. But at least you’re not fighting with as much incidental complexity,
0
0
10
@fredine
Eric Fredine
2 years
@Cernovich I’m probably well to left of you on most things. And old enough that I was there for the outrageous responses to the Satanic Verses. And I’m fully outraged again.
1
0
8
@fredine
Eric Fredine
4 months
This definition of Algebraic Data Types (ADTs) makes sense to me. I have to look it up every time to remember which is which. Easier for me to remember when I think in more concrete terms. In Rust: - product type is a struct or tuple - sum type is an enum
@p1xelHer0
pontus 🔺
4 months
@Aron_Adler I think of ADTs as Sum types + Product types + Pattern matching. The whole vibe.
1
0
19
2
1
8
@fredine
Eric Fredine
4 months
@anerdguynow The set method of the Map prototype?
1
0
10
@fredine
Eric Fredine
1 month
Flexible version supporting floats or ints for score:
Tweet media one
1
1
9
@fredine
Eric Fredine
2 years
@Cernovich I was puzzled you seemed so cocky early in the evening. I don’t think there is much upside in projecting from very sparse data.
2
0
9
@fredine
Eric Fredine
18 days
Did reactive streams ever achieve a critical mass of popularity? The learning curve of the domain specific languages and difficulty of debugging suggested to me they would remain fairly niche.
4
1
8
@fredine
Eric Fredine
2 months
So macros are basically php for Rust?
2
0
9
@fredine
Eric Fredine
4 months
@chrisalbon Executive herd mentality
0
0
9
@fredine
Eric Fredine
15 days
When I first started using Rust I felt like this. But now I’m happy with it as is. I’ve gotten used to the ways of the borrow checker.
@thdxr
dax
15 days
holy shit i’ve been asking for this forever compile to go language that has a better type system please let’s make this huge
15
3
213
2
0
9
@fredine
Eric Fredine
1 month
I really hate inheritance as a construct. Happy that Rust doesn’t have it. Loathe that it’s still pervasive in the PHP code I have to navigate. Happy that Typescript is mostly mousing away from it.
1
0
9
@fredine
Eric Fredine
3 months
It’s Day 3 of people fighting about whether or not people should learn C. The Harvard introduction to computer science course starts with C and then moves on to Python. I thought it was an interesting approach, but I suspect it has a high abandonment rate.
3
0
9
@fredine
Eric Fredine
8 months
@housecor @jsmlDev Oh - yes - can confirm that people will craft heavy queries
1
0
9
@fredine
Eric Fredine
3 months
The #1brc has wrapped up. I learnt some things and it introduced me to some interesting people to follow. A great success I’d say!
@gunnarmorling
Gunnar Morling 🌍
3 months
📢 #1BRC —The Results Are In! Oh what a ride it was. A big congrats to the winners 🥇 @thomaswue / @quananh1999 / @TheMukel 🥈 Artsiom Korzun 🥉 @jerrinot and everyone else on the leaderboard! What a great experience. Complete results and some stats: 👉
Tweet media one
Tweet media two
13
88
363
0
1
9
@fredine
Eric Fredine
5 months
@thdxr I worry about whether the company is healthy enough to sustain it. Especially if it’s something I’d be making a fundamental bet on.
2
0
8
@fredine
Eric Fredine
5 months
@ryanflorence Why is everyone using tens of thousands of records as the benchmark? It’s certainly a realistic size for many use cases but what about millions and tens of millions or more? Those come up too.
2
0
8
@fredine
Eric Fredine
3 months
@kiyov09 This one is fast, simple and idiomatic and posted a few days after it started.
2
0
8
@fredine
Eric Fredine
27 days
@anerdguynow Oh yeah. Coding, fly-fishing and photography - intermittent re-enforcement.
1
0
7
@fredine
Eric Fredine
2 years
@JohnBrownlow It’s not just crypto - there’s a generation of people who have not experienced down markets.
1
0
8
@fredine
Eric Fredine
2 months
@capetorch @clattner_llvm @Modular Only partly open source though?
0
0
8
@fredine
Eric Fredine
24 days
@rustafariandev When my son was 3 he wanted to get a motorcycle. I told him he couldn’t even ride a bike yet so how could he get a motorcycle? So he learned to ride a bike then insisted we go get him a motorcycle. He was very upset when he learnt he was still not going to be able to ride one!
0
0
8
@fredine
Eric Fredine
5 months
@Scobleizer @ChickfilA I tried desperately to get Siri to give me directions to a Starbucks I knew was ahead of me on the road I was travelling but kept trying to send me back to the one I’d already passed because it was closer.
1
0
7
@fredine
Eric Fredine
20 days
I had a moment thinking dhh was posting about Java.
@dhh
DHH
21 days
End of an era for spring. You served us well for a while, good friend. But progress waits for no complication. The spoils of faster silicon should be simpler stacks. (This is already the default for new Rails apps!).
Tweet media one
24
21
520
1
0
8
@fredine
Eric Fredine
1 year
@DougSaunders I think I’m seeing more of your tweets now. So that feels like a small win.
1
0
8
@fredine
Eric Fredine
1 month
@LewisCTech @ChShersh Rust is more expressive in this case:
Tweet media one
2
0
8