<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Api Design on Phosphor BBS</title>
		<link>https://phosphorbbs.net/tags/api-design/</link>
		<description>Recent content in Api Design on Phosphor BBS</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
		
			<lastBuildDate>Sat, 19 Sep 2026 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="https://phosphorbbs.net/tags/api-design/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>UserDefaults for a BBS: A Generic Preferences and State API</title>
				<link>https://phosphorbbs.net/blog/userdefaults-for-a-bbs-a-generic-preferences-and-state-api/</link>
				<pubDate>Sat, 19 Sep 2026 00:00:00 +0000</pubDate>
				<guid>https://phosphorbbs.net/blog/userdefaults-for-a-bbs-a-generic-preferences-and-state-api/</guid>
				<description>&lt;p&gt;Every non-trivial app eventually faces the same question: where does&#xA;small user configuration live, and where does user &lt;em&gt;data&lt;/em&gt; live? macOS&#xA;answered this decades ago with two separate systems — &lt;code&gt;UserDefaults&lt;/code&gt;&#xA;for typed, user-visible settings, and the file system for documents.&#xA;We had been living with neither, and it showed.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-mess-we-had&#34;&gt;The mess we had&lt;/h2&gt;&#xA;&lt;p&gt;Phosphor already had a real preference engine. &lt;code&gt;PreferenceResolver&lt;/code&gt;&#xA;resolves settings through three levels — user, then group, then&#xA;global — backed by the database, cached with proper invalidation, and&#xA;connected across processes with Postgres &lt;code&gt;LISTEN/NOTIFY&lt;/code&gt;. Screens&#xA;could even bind to a preference reactively, so flipping a toggle&#xA;redraws every open screen instantly. For the language side, &lt;code&gt;.phos&lt;/code&gt;&#xA;scripts read settings with &lt;code&gt;pref(&amp;quot;key&amp;quot;)&lt;/code&gt; and write them with&#xA;&lt;code&gt;set_pref(&amp;quot;key&amp;quot;, value)&lt;/code&gt;.&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
