Summer School With The Rust Compiler
http://patshaughnessy.net/2018/10/24/summer-school-with-the-rust-compiler [patshaughnessy.net]
2018-10-25 20:37
tags:
intro-programming
ruby
rust
Not sure if I learned more about rust or ruby here.
Rust is telling me that iter() yielded references to integers, but my code expected an actual integer, not a reference to an integer.
Now the array was mutated! It turns out Ruby passed integers to the closure by value, but strings by reference. Updating each string inside the loop also updated that string inside the array.
I managed to be surprised by both those statements.
How Rust Implements Tagged Unions
http://patshaughnessy.net/2018/3/15/how-rust-implements-tagged-unions [patshaughnessy.net]
2018-03-29 18:46
tags:
c
cpu
programming
rust
Not sure what a tagged union is? Or why it’s an improvement over an old fashioned C union? Today I’ll explain. First I’ll start with a quick review of C unions, how they work and why they are dangerous. Then I’ll show you how Rust enums improve on them.
Learning Rust: If Let vs. Match
http://patshaughnessy.net/2018/1/18/learning-rust-if-let-vs--match [patshaughnessy.net]
2018-01-18 19:41
tags:
compiler
intro-programming
rust
This intrigued me. The phrase “syntactic sugar” implies the two code snippets don’t only produce the same results, it means the compiler generates exactly the same code in each case. Does the Rust compiler really generate exactly the same code for if let as it does for match? Read on to find out.
Trying to Represent a Tree Structure Using Postgres
http://patshaughnessy.net/2017/12/11/trying-to-represent-a-tree-structure-using-postgres [patshaughnessy.net]
2017-12-11 22:16
tags:
compsci
database
programming
series
sql
This week I’ll publish a series of blog posts on the Postgres LTREE extension. I’ll get started today by trying to insert a tree structure into a Postgres table using standard SQL, and during the rest of the week I’ll take a close look at LTREE: how to install it, how to use it, and how it works.
Pointers in C and x86 Assembly Language
http://patshaughnessy.net/2017/1/20/pointers-in-c-and-x86-assembly-language [patshaughnessy.net]
2017-01-22 03:28
tags:
c
cpu
intro-programming
Today I’ll read and try to understand a very simple x86 assembly language program that reads from and writes to memory. To make the x86 instructions a bit easier to follow, I’ll first rewrite them using C pointer syntax. If you’re an experienced C programmer, this will make the x86 code easy to read. Or if you’re not familiar with C, this is your chance to learn both C and x86 pointer syntax at the same time.
Learning to Read x86 Assembly Language
http://patshaughnessy.net/2016/11/26/learning-to-read-x86-assembly-language [patshaughnessy.net]
2016-11-26 17:57
tags:
cpu
programming
What a train wreck! It’s hard to imagine a more confusing state of affairs. But again, remember all of this has evolved over the course of 40 years.
The good news is you don’t have to write it, only read it.