Weeknotes 2022 W26: Funemployed

June 27​–​July 3, 2022
1300 words

Friday was the first day of July and also the official start of my funemployment. By the time I start my role in August, I’ll have had a break of almost two months, which feels very nice.

July also marks the end of pride month in the US, but not in Germany where July is pride month. I won’t attend the pride parade in Berlin later this month though (CSD, for Christopher Street Day), as I’ll be in Belgium at that time.


I finalized my GitHub Sponsors setup, but likely just a little too late to take advantage of GitHub’s effort to thank maintainers. After all, Nanoc is used at GitHub. I’ve not gotten word from GitHub, which means I probably missed out on the $550.

Anyway, at least my my GitHub sponsors profile is now live.

I also changed my GitHub username. It used to be ddfreyne (for historical reasons) but is now the much cleaner denisdefreyne.


Gex, the programming language I’m working on, now supports methods. Here is a demo of a Vector struct:

struct Vector {
  x: Float64,
  y: Float64,

  fn offset_x(self, x: Float64) -> Vector {
    return Vector {
      x = x + self.x,
      y = self.y
    };
  }
}

fn main() {
  var vec : Vector = Vector { x = 100.0, y = 200.0 };

  var offset_vec : Vector = vec.offset_x(50.0);
  println_float64(offset_vec.x);
  println_float64(offset_vec.y);
}

Hilariously, LLVM manages to optimize that code to what would in C essentially be the following:

printf("%.2f\n", 150.0);
printf("%.2f\n", 200.0);

You’re doing a good job, LLVM.

For now, all structs are allocated on the stack, and structs are passed by value. This is quite different from how languages like Ruby and Java work, so I think this might cause some confusion. Take a look at this:

struct Point {
  x: Float64,
  y: Float64,
}

struct Size {
  width: Float64,
  height: Float64,
}

struct Rect {
  origin: Point,
  size: Size,
}

fn main() {
  var first: Rect = Rect {
    origin = Point { x = 10.0, y = 20.0 },
    size = Size { width = 50.0, height = 60.0 }
  };
  var second: Rect = Rect {
    origin = Point { x = 30.0, y = 40.0 },
    size = Size { width = 70.0, height = 80.0 }
  };

  println_float64(first.size.width);

  first.size = second.size;
  println_float64(first.size.width);

  second.size.width = 90.0;
  println_float64(first.size.width);
}

The first call to println_float64(first.size.width) prints 50.0, because that is the width that first was created with. No surprises there.

The second call to println_float64(first.size.width) prints 70.0, because the line above it, first.size = second.size, changes the size of first to be the same as the size of second. This, too, is not surprising.

The third call to println_float64(first.size.width), however, also prints 70.0, not 90.0. This happens because the line first.size = second.size copies the value of second.size over to first.size. There are no references here: first.size is not a reference to second.size. If it were, then modifying second.size would also (implicitly) change first.size.

To me, it’s clear why this code prints 70.0 rather than 90.0, but I can also understand why this can be confusing. I believe that for people familiar with languages like C and Rust, 70.0 is more natural, and for people familiar with languages like Java and Ruby, 90.0 would be expected.

So where do I go from here? I have two choices:

I’m conflicted as to which approach to take. The second (explicit reference types) is something I occasionally long for when using Ruby, but adds considerable complexity in both usage of the programming language as well as the compiler.

This feels like a fundamental decision to make, and I’ll need to take the time to explore both options to figure out what I want to do.

Also, given that I have about two and a half weeks left of unplanned vacation, I wonder whether I’ll even continue with the implementation of this language at all. It’s certainly fun, but also quite challenging, and it requires quite a lot of mental energy, which I might not have at all once I start my new role on August 1st.


I’m giving my next talk, A language built with third-party code reuse in mind, this Thursday at RUG::B. I’m ready for it.

It’s not yet clear whether it’ll be in a physical location or online — I think it mainly depends on the COVID-19 situation in Berlin. I’m longing to resume giving in-person talks, but the risk needs to be low.


I picked up Tropico 6 at a discount, but I find it quite a difficult game. Early on, I often fail to declare independence on time, and thus lose the game. Even if I make it past that point, my election approval rating drops to around 2% which is very much not high enough. Tropico 6 is hard, and I’m playing on easy mode.

I picked up The Boys season 2. I watched the first season quite a while back but never properly started with season 2. It’s not the easiest to watch (quite some abuse and violence).

I lost my 37-day Wordle streak and now I’m too grumpy to keep on playing Wordle. I’m genuinely not a fan of the concept of streaks.


Links:

Cryptocurrency links:

You can reply to this weeknotes entry by email. I’d love to hear your thoughts!
If you like what I write, stick your email address below and subscribe. I send out my weeknotes every Sunday morning. Alternatively, you can subscribe to the web feed.
Incoming links: Ideas.