logoalt Hacker News

Union Types and Option Types (2025)

14 points • by g0xA52A2A • last Monday at 8:08 PM • 4 comments • view on HN

Comments

p1necone • today at 12:21 AM

One simple but non obvious (at least to me) trick when implementing tagged unions: put the union discriminator/tag at the end, not the beginning - that way a pointer to a union is also a pointer to the value, no need to increment the pointer to point past the tag after discriminating.

gnabgib • last Monday at 8:39 PM

(2025) And about CopperLang (203 points, 3 days ago, 120 comments) https://news.ycombinator.com/item?id=50308754

direwolf20 • yesterday at 11:53 PM

i read Onion Types

➕ show 1 reply