When writing concurrent Rust you will encounter Arc and Mutex
types sooner or later. And although Mutex might already sound
familiar as it's a concept known in many languages, chances are you
haven't heard about Arc before Rust. What's more, you can't fully
understand these concepts without tying them to the ownership model
in Rust. This post is my take on understanding Arc and Mutex in
Rust.
When a single mom and her two kids arrive in a small town, they
begin to discover their connection to the original Ghostbusters and
the secret legacy their grandfather left behind.
In the evening we watched Ghostbusters:
Afterlife. I liked the movie
and give it a 7 out of 10.
An article titled Rust Is Hard, Or: The Misery of Mainstream
Programming
came out today and it's getting a lot of attention. I have a feeling
that it's viewed in a wrong context, so I'd like to comment on the
issue raised there.
I recently got a copy of the book Compiling to Assembly from
Scratch
by Vladamir Keleshev, which details how to write a compiler for a
subset of JavaScript to 32-bit ARM assembly code. The choice to use
ARM assembly is mainly for its simplicity in comparison to x86.
Keleshev elects to use TypeScript to write the compiler, which, as
he explains in the preface, is largely a compromise for its familiar
C-like syntax while still providing many functional programming
features desireable for writing a compiler. However, I chose to
write my version of the compiler in Haskell as it's my favorite
language, and the focus on functional programming from Keleshev
makes it a natural choice for the translation.
Overall, I had a lot of fun writing this compiler as I got to learn
more about the nitty-gritty low-level of how code is executed while
getting more practice with Haskell. In this post, I won't cover
every detail of the design of the compiler, but I'll try to hit on
what I found to be the most important or interesting aspects of the
code.
Captain Barbossa, Will Turner and Elizabeth Swann must sail off the
edge of the map, navigate treachery and betrayal, find Jack Sparrow,
and make their final alliances for one last decisive battle.
In the evening Esme, Alice, and I watched Pirates of the Caribbean:
At World's End. I liked the
movie a little less than the previous two and give it a 6.5 out of 10.
In this post I hope to explain why bidirectional
type-checking has a
lot of cultural cachet within the programming language theory
community. To be clear, I’m an amateur and I have no formal
background in computer science or type theory. Nonetheless, I
believe I’ve learned enough and compared notes with others to
motivate bidirectional type-checking.
When you use Rust, it is sometimes outright preposterous how much
knowledge of language, and how much of programming ingenuity and
curiosity you need in order to accomplish the most trivial things.
systemd services and timers are a game changer if you’re used to
cron jobs. This looks at a couple of simple real-life examples to
show off the advantages.
Trivially find out which cron events ran, or will run, for an
arbitrary time range; allowing you to rerun, debug, fast forward
(speed up test iterations), with cron-sequencer.
On our way to the town centre we encountered a duck with five
ducklings. I got off my bike and took some photos. I had seen the same
duck with ducklings earlier this week but was too much in a hurry to
take photos back then.
I wonder if she's the same mother duck we saw last year, also with
five
ducklings.
So far, I have concentrated on trying to understand how macOS
allocates threads to the two different types of core in M1 series
processors, and how running threads on the E cores can lead to
increased energy efficiency. This article looks at how P core
frequencies are controlled by macOS, and the dynamics of frequency
change.
Every now and again I come across some discussion on making Emacs
“modern”.1
The argument always go more or less like this - Emacs doesn’t look
and behave like and the
world will end if we don’t copy something “crucial” from it.
While I’m not a programmer per se, I do use git almost daily and
find it a great tool for source control and versioning of plain text
files. But I don’t think there can be any doubt that it is not the
easiest tool to use. But despite its
unintuitive user interface, under the hood git is quite simple and
elegant. I believe that if you can understand the fundamental
constructs git uses to store, track, and manage files, then the
using git becomes a lot easier.
In this article we’re going to take a look under the covers and
investigate git’s fundamental constructs. We’ll start off with its
storage model and look at blobs, trees and commits. We’ll see how
branches are implemented, and finally we’ll unpack the git index
file to understand what happens during the staging of a commit.
Yesterday, I released perl v5.36.0. I think this is the most
exciting release of perl in quite some time, and I’m hoping that in
a few months, I’ll still be as pleased with it as I am today. Here’s
a summary of what we got done, what we didn’t get done, and (to some
extent) how it got done.
During my afternoon break I finished the third book of the Dune
Chronicles by Frank Herbert: Children of
Dune. I
liked the book a little less than the previous two but I still
recommended it.
Sometimes, sharing the same object within your code is exactly
what you want.
For example, you can create a class that behaves de facto like a
singleton by using the borg pattern. It’s called borg pattern as a
reference to the Borgs in Star Trek where they are linked in a
hive mind called the Collective.
I explained the Borg pattern in detail on my blog here.
In this article, however, we have learned how to avoid such pitfalls
when we do not want to share information in presumably different
variables. I sometimes refer to the examples in this article as
involuntary borgs.
Millennia have passed on Arrakis, and the once-desert planet is
green with life. Leto Atreides, the son of the world’s savior, the
Emperor Paul Muad’Dib, is still alive but far from human. To
preserve humanity’s future, he sacrificed his own by merging with a
sandworm, granting him near immortality as God Emperor of Dune for
the past thirty-five hundred years.
Leto’s rule is not a benevolent one. His transformation has made not
only his appearance but his morality inhuman. A rebellion, led by
Siona, a member of the Atreides family, has risen to oppose the
despot’s rule. But Siona is unaware that Leto’s vision of a Golden
Path for humanity requires her to fulfill a destiny she never
wanted—or could possibly conceive....
In the evening I started in book 4 of the Dune Chronicles by Frank
Herbert: God Emperor of Dune.
There are a lot of simple ideas that float about in
programming. Many that are conceptually simple, yet end up being a
bit tricky for you to implement. Right until the moment you see how
somebody else does it, and you have a more concrete feeling for the
simplicity.
I recently had a funny experience that turned out to be a great
education in mutability of objects, especially strings, in
Python. The experience came as a result of messing up on two Python
brainteasers, getting annoyed about a seeming contradiction in the
language functionality, and then going down a fascinating rabbit
hole.