<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tagged Unions on MacWorks</title><link>https://macworks.dev/tags/tagged-unions/</link><description>Recent content in Tagged Unions on MacWorks</description><generator>Hugo</generator><language>en</language><atom:link href="https://macworks.dev/tags/tagged-unions/index.xml" rel="self" type="application/rss+xml"/><item><title>Engineer Reads</title><link>https://macworks.dev/docs/today/engineer-blogs-2026-07-20/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://macworks.dev/docs/today/engineer-blogs-2026-07-20/</guid><description>&lt;h1 id="engineering-reads--2026-07-20"&gt;Engineering Reads — 2026-07-20&lt;a class="anchor" href="#engineering-reads--2026-07-20"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="the-big-idea"&gt;The Big Idea&lt;a class="anchor" href="#the-big-idea"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The most theoretically difficult memory safety problem to solve—type confusion via tagged union aliasing—is not necessarily the most impactful one to fix in practice. Pragmatic language design should prioritize mitigating highly exploitable issues like buffer overflows with simple mechanisms like bounds checking and slice syntax, rather than purely chasing theoretical soundness.&lt;/p&gt;
&lt;h2 id="deep-reads"&gt;Deep Reads&lt;a class="anchor" href="#deep-reads"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://matklad.github.io/2026/07/20/memory-safety-hardest-problem.html"&gt;Memory Safety’s Hardest Problem&lt;/a&gt;&lt;/strong&gt; · matklad
The hardest conceptual memory safety challenge doesn’t stem from heap allocation or destructors, but rather from type confusion in tagged unions. The technical mechanism is subtle: if you initialize a union as type A, take a pointer to its internal data, overwrite the union as type B, and then dereference the initial pointer, you end up reading B&amp;rsquo;s bytes through A&amp;rsquo;s type definition. While this edge case successfully breaks the memory models of even strict languages like Ada, the author argues that its real-world exploitability remains unclear compared to ubiquitous threats. The industry&amp;rsquo;s true failure was ignoring pragmatic solutions to the most common exploits—like Walter Bright&amp;rsquo;s argument for introducing slice syntax (&lt;code&gt;char a[..]&lt;/code&gt;) to C to trivially bound-check buffer overflows. Anyone evaluating systems programming languages or designing safety mitigations should read this to recalibrate the balance between theoretical correctness and practical exploit prevention.&lt;/p&gt;</description></item></channel></rss>