Union Types and Option Types

NewLearning & Bookstibleiz.netSince 2009

Union Types and Option Types

Quick read

A blog post describing the author’s experiments adding union types and a simpler option type (T|Nothing or T?) to their low-level language Copper, including design choices and implementation details. It explains why the author favored option types: they integrate with C, are efficient (no tag), flexible, and how the language refines optionals, checks for nil, and offers ergonomics like notNil, def

  • Explains implementing option types by reserving a nil value per type
  • Describes runtime and compiler refinements for safely accessing optionals
  • Lists ergonomics: notNil, defopt, inferred non-nil analysis

Reactions

No reactions yet. Record a short about this link and it shows up here, in Reels and in the community feed.

Is tibleiz.net your site? Sign in to verify it and get a Verified badge, full stats and a link-back badge.

A closer look at Union Types and Option Types

What this post is about

This is a blog post describing experiments with union types and, more specifically, option types in the author’s low-level language called Copper. It explains what union types are, why the author found the general union feature too complex for Copper, and motivates focusing on the option type (T|Nothing or T?).

What you can learn or do from the post

Read how the author implemented option types in Copper by reserving a special nil value inside the original type, with examples for pointers and other concrete representations (pointer 0, a reserved integer like -1, or a reserved 32-bit pattern for colors). The post details trade-offs: good interoperability with C, efficiency (no tag), flexibility, but issues when a type has no reservable nil value and the impossibility of nested option types (T??). It also covers refinement patterns, checks, a runtime notNil helper for debug, method definitions on optional types, macros like ifNil, and compiler-based inference of non-nil locals (similar to TypeScript/Kotlin) with some analysis limitations on loops.

Who will find it useful

Language implementers and systems-language programmers interested in low-level, tagless option/nullable representations will get concrete ideas and trade-offs. People working on interop with C or designing compact option semantics for primitive and pointer types will find the implementation notes practical. It is less relevant if you need a fully specified language feature or formal semantics beyond the author’s implementation and experiences.

Questions people ask about Union Types and Option Types

Does the post explain how nil is represented for different types?
Yes: it describes reserving a nil value per type, with examples like address 0 for pointers, -1 for signed indices, or a reserved bit pattern in an integer holding RGB color data.
Will Copper allow nested option types like T???
The post explicitly says T?? is not possible with this implementation approach.
Does the author add runtime checks for unsafe casts from T? to T?
The author did not change the language cast operator but added a standard-library notNil method that performs a runtime check in debug mode; other approaches include compiler inference and explicit check constructs discussed in the post.

Union Types and Option Types was shared on NexURLs by Nexis on November 3, 2026, in Learning & Books.

What we found on this site

Served through
Apache
Home page answered in
267 ms
Trackers
None found
Ads
None found
RSS feed
No
AI crawlers
Blocks OpenAI and Anthropic
Set up for phones
No
Real-visitor speed
Passes Core Web Vitals
Popularity
Top 200,000 domain (Cloudflare)
Google safety check
No threats found
Domain registered
2009
Domain renews
October 2027

Checked November 3, 2026 from the site’s own code and public records. See how the rest of the web compares in the NexURLs Internet Report.

Quick answers

What is Union Types and Option Types?

Union Types and Option Types (tibleiz.net): A blog post describing the author’s experiments adding union types and a simpler option type (T|Nothing or T?) to their low-level language Copper, including design choices and implementation details. It explains why the author favored option types: they integrate with C, are efficient (no tag)...

Who shared Union Types and Option Types on NexURLs?

It was shared by Nexis in November 2026. Every link on NexURLs is shared by a real member and passes a safety check before it goes out.

What are some sites like Union Types and Option Types?

Members found these close to it: Compile-Time Dependent Types, TypingClub, Public Books. The full list is on this page under Sites like Union Types and Option Types.

Sites like Union Types and Option Types

More Learning & Books finds

All Learning & Books websites →

Feeling lucky? Try the random website generator.

Where people went next

Nobody has added a next stop yet. Be the first.

Five finds like this, every morning

Five great websites every morning, picked by people and written up by AI. Free, and one click to stop.

Remember Me
Scroll to Top

More

📰 Latest Posts
📊 Community Stats
👋 New Members
👥 Popular Groups