Skip to content

Instantly share code, notes, and snippets.

View Aras14HD's full-sized avatar
💭
currently focusing on School

Aras Aras14HD

💭
currently focusing on School
View GitHub Profile
@Aras14HD
Aras14HD / README.md
Last active August 25, 2024 19:57
A Unified Typesystem: Partial, Variant, Borrowed Types and more

A Unified Typesystem: Partial, Variant, Borrowed Types and more

Recently I stumbled over the blog post The Inconceivable Types of Rust.

It stuck with me, the ideas were great, but felt unpolished, so I thought about it and I want to share those thoughts with you. In this post I aim to outline what these concepts are and their applications, what syntax I feel fits well, and broadly how one might design a type checker for this.

Partials

Let's start with partial types, these already kind of exist in Rust in, what Considerations on Codecrafting called it, a shadow type system. A partial types is the type of variable, that has been partially moved or initialized (or borrowed or variant). These are currently undescribable and only exist within functions, a way to write them could be:

@Aras14HD
Aras14HD / music.txt
Last active May 30, 2024 12:45
My Music List (Mostly (Electro) Swing)
TITLE - ARTIST
Oopsy Sorry - Balduin & Annella
Oh So Hot - Gavin Luke
Baska Brother - Parov Stelar
People Rising (feat. Mc Little Tree) - Kormac
Viper Queen - Riff Kitten
Chill with Caravan Palace - Caravan Palace
Forever and Ever - Boogie Belgique
No Tomorrow - ALI
Temptations - ALI