Skip to content

Instantly share code, notes, and snippets.

@devast8a
devast8a / cyclic-references-in-fang.md
Last active October 11, 2026 01:08
Cyclic References in Fang

Cyclic References in Fang

Fang is a programming language I'm designing that is intended to make correct software easy for all developers to write. It features group borrow checking, which I highly recommend you read and understand before reading this article, to ergonomically check the use of multiple mutable aliases. This article explains how Fang safely represents data structures with cyclic references.

Getting up to Speed

Let's start with a quick tour of Fang. Parameters are passed by reference.

fn greetPerson(person: Person) { ... }

let you = Person{}

# `you` doesn't get copied or moved
@devast8a
devast8a / 001-Bridge.lua
Created August 6, 2012 12:19
A lua console for the powder toy (powdertoy.co.uk)
-- Really there's no point in using this file.
-- Though if you so desire, just copy it into the same place as console.lua and run both the files.
-- Support cracker's manager
local using_manager = pcall(MANAGER_EXISTS)
if using_manager then
local v = MANAGER_VERSION()
MANAGER = {