Skip to content

Instantly share code, notes, and snippets.

View Verdagon's full-sized avatar

Evan Ovadia Verdagon

View GitHub Profile
#include <memory>
#include <variant>
#include <iostream>
struct Engine {
int fuel;
Engine(int fuel_) : fuel(fuel_) {}
};
@Verdagon
Verdagon / gist:cd28b7c47c5d4c8c941336e7c91cf931
Created December 15, 2025 18:07
CircuitousShapeshift2.cpp
#include <memory>
#include <variant>
#include <iostream>
struct Engine {
int fuel;
Engine(int fuel_) : fuel(fuel_) {}
};
struct Navigation: ~Copyable {
var antenna: Bool
}
struct Engine: ~Copyable {
var warp_coils: [Int]
}
enum Variant: ~Copyable {
case navigation(Navigation)
#include <memory>
#include <variant>
#include <iostream>
struct Engine {
int fuel;
Engine(int fuel_) : fuel(fuel_) {}
};
import Foundation
class Engine {
var fuel = 100
}
class Spaceship {
var engine = Engine()
}
func accelerate(_ ship: Spaceship) {
let engine = ship.engine // Race: read
// literally no field access
#include <memory>
#include <thread>
struct Engine {
int fuel = 100;
};
struct Spaceship {
std::shared_ptr<Engine> engine = std::make_shared<Engine>();
};
void accelerate(std::shared_ptr<Spaceship> ship) {
std::shared_ptr<Engine> engine = ship->engine;
struct Navigation: ~Copyable {
var antenna: Bool
}
struct Engine: ~Copyable {
var fuel: Int
}
enum Variant: ~Copyable {
case navigation(Navigation)

Article Skeleton

title options:

  • A Memory Safety Enigma in the Mojo Standard Library
  • Mojo's Dependent Types and Memory Safety

I was doing my normal thing in Mojo, implementing struct extensions, when I came across this function in the standard library:

Article Skeleton

title options:

  • A Memory Safety Enigma in the Mojo Standard Library
  • Mojo's Dependent Types and Memory Safety

I was doing my normal thing in Mojo, implementing struct extensions, when I came across this function in the standard library:

# Article Skeleton
title options:
- A Memory Safety Enigma in the Mojo Standard Library
- Mojo's Dependent Types and Memory Safety
--------
I was doing my normal thing in Mojo, implementing struct extensions, when I came across this function in the standard library: