<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>What do you want? &#8211; Wade Tregaskis</title>
	<atom:link href="https://wadetregaskis.com/tags/what-do-you-want/feed/" rel="self" type="application/rss+xml" />
	<link>https://wadetregaskis.com</link>
	<description></description>
	<lastBuildDate>Tue, 02 Jan 2024 16:31:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://wadetregaskis.com/wp-content/uploads/2016/03/Stitch-512x512-1-256x256.png</url>
	<title>What do you want? &#8211; Wade Tregaskis</title>
	<link>https://wadetregaskis.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">226351702</site>	<item>
		<title>&#8216;Fake error&#8217; about immutable values when using popFirst() on Array</title>
		<link>https://wadetregaskis.com/fake-error-about-immutable-values-when-using-popfirst-on-array/</link>
					<comments>https://wadetregaskis.com/fake-error-about-immutable-values-when-using-popfirst-on-array/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Tue, 13 Feb 2018 05:38:57 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Bugs!]]></category>
		<category><![CDATA[lies]]></category>
		<category><![CDATA[Stupid Compiler Messages]]></category>
		<category><![CDATA[Swift]]></category>
		<category><![CDATA[What do you want?]]></category>
		<guid isPermaLink="false">https://blog.wadetregaskis.com/?p=4081</guid>

					<description><![CDATA[It&#8217;s been a while since I wrote any meaningful Swift. &#160;How I&#160;didn&#8217;t miss the Swift compiler&#8217;s bullshit error messages. That yields, on the popFirst() method: Cannot use mutating member on immutable value: 'someArray' is immutable. No it&#8217;s not. &#160;It&#8217;s simply not. For whatever reason, if you instead call popFirst() on ArraySlice &#8211; ostensibly indistinguishable from&#8230; <a class="read-more-link" href="https://wadetregaskis.com/fake-error-about-immutable-values-when-using-popfirst-on-array/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>It&#8217;s been a while since I wrote any meaningful Swift. &nbsp;How I&nbsp;<em>didn&#8217;t</em> miss the Swift compiler&#8217;s bullshit error messages.</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-disabled" data-code-block-pro-font-family="" style="font-size:.875rem;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><pre class="shiki light-plus" style="background-color: #FFFFFF" tabindex="0"><code><span class="line"><span style="color: #0000FF">var</span><span style="color: #000000"> someArray = [</span><span style="color: #A31515">&quot;Foo&quot;</span><span style="color: #000000">, </span><span style="color: #A31515">&quot;Bar&quot;</span><span style="color: #000000">]</span></span>
<span class="line"></span>
<span class="line"><span style="color: #AF00DB">if</span><span style="color: #000000"> </span><span style="color: #0000FF">let</span><span style="color: #000000"> foo = someArray.</span><span style="color: #795E26">popFirst</span><span style="color: #000000">() {</span></span>
<span class="line"><span style="color: #000000">    </span><span style="color: #795E26">print</span><span style="color: #000000">(</span><span style="color: #A31515">&quot;Who cares, we never get here anyway.&quot;</span><span style="color: #000000">)</span></span>
<span class="line"><span style="color: #000000">}</span></span></code></pre></div>



<p>That yields, on the <code>popFirst()</code> method:</p>



<pre class="wp-block-preformatted">Cannot use mutating member on immutable value: 'someArray' is immutable.</pre>



<p>No it&#8217;s not. &nbsp;It&#8217;s simply not.</p>



<p>For whatever reason, if you instead call <code>popFirst()</code> on <code>ArraySlice</code> &#8211; ostensibly indistinguishable from a real <code>Array</code> &#8211; it works just fine.</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-disabled" data-code-block-pro-font-family="" style="font-size:.875rem;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><pre class="shiki light-plus" style="background-color: #FFFFFF" tabindex="0"><code><span class="line"><span style="color: #0000FF">var</span><span style="color: #000000"> someArray = [</span><span style="color: #A31515">&quot;Foo&quot;</span><span style="color: #000000">, </span><span style="color: #A31515">&quot;Bar&quot;</span><span style="color: #000000">][</span><span style="color: #098658">0</span><span style="color: #000000">...]</span></span>
<span class="line"></span>
<span class="line"><span style="color: #AF00DB">if</span><span style="color: #000000"> </span><span style="color: #0000FF">let</span><span style="color: #000000"> foo = someArray.</span><span style="color: #795E26">popFirst</span><span style="color: #000000">() {</span></span>
<span class="line"><span style="color: #000000">    </span><span style="color: #795E26">print</span><span style="color: #000000">(</span><span style="color: #A31515">&quot;Yet this works correctly.&quot;</span><span style="color: #000000">)</span></span>
<span class="line"><span style="color: #000000">}</span></span></code></pre></div>



<p>Sigh.</p>



<p>I presume it&#8217;s trying to tell me something stupidly obscure about Swift&#8217;s byzantine type system. &nbsp;Good luck finding out what. &nbsp;Good luck even finding the definition of the <code>popFirst()</code> method, since Xcode claims it doesn&#8217;t exist if you Command-Control-click on it. &nbsp;But Xcode can&#8217;t find most things, so that in itself says very little.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/fake-error-about-immutable-values-when-using-popfirst-on-array/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4081</post-id>	</item>
		<item>
		<title>Your system has run out of application memory HUR HUR HUR</title>
		<link>https://wadetregaskis.com/your-system-has-run-out-of-application-memory-hur-hur-hur/</link>
					<comments>https://wadetregaskis.com/your-system-has-run-out-of-application-memory-hur-hur-hur/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Tue, 16 May 2017 17:22:47 +0000</pubDate>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[Broken by design]]></category>
		<category><![CDATA[Bugs!]]></category>
		<category><![CDATA[deadlock]]></category>
		<category><![CDATA[disk space]]></category>
		<category><![CDATA[hung]]></category>
		<category><![CDATA[killall]]></category>
		<category><![CDATA[lies]]></category>
		<category><![CDATA[Lightroom]]></category>
		<category><![CDATA[macOS]]></category>
		<category><![CDATA[paging]]></category>
		<category><![CDATA[paused]]></category>
		<category><![CDATA[RAM]]></category>
		<category><![CDATA[Sad]]></category>
		<category><![CDATA[SIGCONT]]></category>
		<category><![CDATA[SIGSTOP]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[What do you want?]]></category>
		<guid isPermaLink="false">https://blog.wadetregaskis.com/?p=3913</guid>

					<description><![CDATA[I hate this dialog with the fire&#160;of a thousand suns. When this appears, it basically means one (or both) of two things: Quitting any of the listed applications is rarely the correct move. &#160;It&#8217;s often enough the case that none of them are the root cause, and you can kill all of them if you&#8230; <a class="read-more-link" href="https://wadetregaskis.com/your-system-has-run-out-of-application-memory-hur-hur-hur/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img fetchpriority="high" decoding="async" width="1078" height="944" src="https://wadetregaskis.com/wp-content/uploads/2017/05/22Your-system-has-run-out-of-application-memory22-dialog.webp" alt="" class="wp-image-3914" style="width:539px" srcset="https://wadetregaskis.com/wp-content/uploads/2017/05/22Your-system-has-run-out-of-application-memory22-dialog.webp 1078w, https://wadetregaskis.com/wp-content/uploads/2017/05/22Your-system-has-run-out-of-application-memory22-dialog-512x448@2x.webp 1024w, https://wadetregaskis.com/wp-content/uploads/2017/05/22Your-system-has-run-out-of-application-memory22-dialog-256x224.webp 256w, https://wadetregaskis.com/wp-content/uploads/2017/05/22Your-system-has-run-out-of-application-memory22-dialog-512x448.webp 512w" sizes="(max-width: 1078px) 100vw, 1078px" /></figure>
</div>


<p>I hate this dialog with the fire&nbsp;of a thousand suns.</p>



<p>When this appears, it basically means one (or both) of two things:</p>



<ol class="wp-block-list">
<li>Some application went nuts and chewed through all your memory and/or disk space.</li>



<li>macOS got itself into a darkly comical &amp; embarrassing deadlock.</li>
</ol>



<p>Quitting any of the listed applications is rarely the correct move. &nbsp;It&#8217;s often enough the case that none of them are the root cause, and you can kill all of them if you want, but it won&#8217;t fix the problem.</p>



<p>One important thing to clarify first, though, is that this dialog does&nbsp;<em>not</em>&nbsp;necessarily use the term &#8216;memory&#8217; in the conventional sense &#8211; i.e. RAM. &nbsp;It&nbsp;can&nbsp;<em>also</em>&nbsp;refer to disk space. &nbsp;Unfortunately it doesn&#8217;t bother to distinguish between the two, which is particularly stupid of it since any possible resolution of the issue is&nbsp;<em>highly</em> dependent on which of the two cases it in fact is.</p>



<p>Thank goodness for iStatMenus, though, which in the most recent incident showed that I had ~20 GiB of RAM completely free (not even inactive, actually outright free). &nbsp;So immediately that rules out what the daft bloody dialog&#8217;s actually saying.</p>



<p>The worst thing about all this is when it&#8217;s #2 the occurs. &nbsp;For example, I had Lightroom do a 63-image panorama merge. &nbsp;As Lightroom is a gross memory pig when doing panorama merging, it consumed something like 40 GiB of memory. &nbsp;Which caused a bunch of stuff to page&nbsp;to disk. &nbsp;Which consumed all the disk space. &nbsp;Which led to that obnoxious dialog. &nbsp;Which&nbsp;<em>further</em> led to macOS in its infinite fucking wisdom &#8216;pausing&#8217; (SIGSTOPing) almost all running programs,&nbsp;<em>including</em> evidently whatever daemon actually handles paging. &nbsp;Thus when Lightroom actually completed the panorama merge&nbsp;and released all that memory, I now had 20 GiB of free memory and the system refused to use any of it to page back in all that memory it&#8217;d paged out. &nbsp;Because it was out of disk space.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="499" height="332" src="https://wadetregaskis.com/wp-content/uploads/2024/01/Tense.avif" alt="" class="wp-image-7320"/></figure>
</div>


<p>The only solution &#8211; short of hard rebooting and hoping it resolves itself &#8211; was to delete a bunch of files I actually do still&nbsp;want, but which will now have to be&nbsp;recovered from a backup. &nbsp;Great job macOS, thanks for all your help.</p>



<p>Of course, even once you do that and recover the system from the derpeche mode it put itself into, it won&#8217;t actually&nbsp;<em>unpause</em> any of the shit it broke. &nbsp;You have to do that manually. &nbsp;It pretends you can do that via that dialog that started the whole thing &#8211; assuming you left it open the entire time, blocking your view as you <em>actually</em> help the situation &#8211;&nbsp;but that only shows user-visible applications, not all the other system &amp; background processes that it&nbsp;<em>also</em> rudely halted.</p>



<p>So, simple tip for resuming everything:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><code>sudo killall -CONT -m '.'</code></p>
</blockquote>



<p>Elegant, after a fashion. &nbsp;Though every time, it reminds me that whomever named it &#8216;killall&#8217; was either not very friendly or not very wise.</p>



<p>Note that the system will probably still be a bit broken in places, as despite what macOS thinks, you can&#8217;t just blindly pause random system tasks and not have things get really, really confused. &nbsp;A reboot is always wise after seeing this dialog, to properly undo its fuckery.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/your-system-has-run-out-of-application-memory-hur-hur-hur/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			<media:content url="https://wadetregaskis.com/wp-content/uploads/2017/05/22Your-system-has-run-out-of-application-memory22-dialog.webp" medium="image" />
<post-id xmlns="com-wordpress:feed-additions:1">3913</post-id>	</item>
		<item>
		<title>iOS Family Sharing users cannot mix authentication schemes</title>
		<link>https://wadetregaskis.com/ios-family-sharing-users-cannot-mix-authentication-schemes/</link>
					<comments>https://wadetregaskis.com/ios-family-sharing-users-cannot-mix-authentication-schemes/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Sat, 15 Apr 2017 19:51:04 +0000</pubDate>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[AppleID]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[Broken by design]]></category>
		<category><![CDATA[Family Sharing]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[Snafu]]></category>
		<category><![CDATA[Two-factor]]></category>
		<category><![CDATA[Two-step]]></category>
		<category><![CDATA[Undocumented]]></category>
		<category><![CDATA[What do you want?]]></category>
		<guid isPermaLink="false">https://blog.wadetregaskis.com/?p=3898</guid>

					<description><![CDATA[Apple supports two styles of two-factor authentication,&#160;that they call (and distinguish as) &#8220;two-step&#8221; vs &#8220;two-factor&#8221;. &#160;&#8220;Two-step&#8221; is their older method, though functionally they&#8217;re basically equivalent. If you have multiple accounts on a Family Sharing arrangement, and some use &#8220;two-factor&#8221; while others use &#8220;two-step&#8221;, you&#8217;re in for&#160;a bag of hurt. For example, any time you change&#8230; <a class="read-more-link" href="https://wadetregaskis.com/ios-family-sharing-users-cannot-mix-authentication-schemes/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>Apple supports two styles of two-factor authentication,&nbsp;that they call (and distinguish as) &#8220;two-step&#8221; vs &#8220;two-factor&#8221;. &nbsp;&#8220;Two-step&#8221; is their older method, though functionally they&#8217;re basically equivalent.</p>



<p>If you have multiple accounts on a Family Sharing arrangement, and some use &#8220;two-factor&#8221; while others use &#8220;two-step&#8221;, you&#8217;re in for&nbsp;a bag of hurt.</p>



<p>For example, any time you change the password on any of the non-master accounts, you&#8217;ll have to reauthorise all devices on that account with the master purchaser. &nbsp;You&#8217;ll be prompted, when trying to download apps or purchase anything etc, with a dialog saying &#8220;Your Family Organizer, [foo], must enter the security code for their payment method&#8221;, asking for some kind of input. &nbsp;There is literally nothing you can enter there that will make it work. &nbsp;Not the password for any of the relevant Apple IDs, not any security codes for any credit cards, nada.</p>



<p>The problem is that it&#8217;s asking for a verification code that you can only create on a device which has &#8220;two-factor&#8221; authentication enabled. &nbsp;Compare for example what you see with &#8220;two-factor&#8221; authentication enabled on your iDevice:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><a href="https://wadetregaskis.com/wp-content/uploads/2017/04/Two-factor.webp" data-wpel-link="internal"><img decoding="async" width="1536" height="2048" src="https://wadetregaskis.com/wp-content/uploads/2017/04/Two-factor.webp" alt="Screenshot of two-factor authentication enabled in iOS account settings" class="wp-image-3899" style="width:768px" srcset="https://wadetregaskis.com/wp-content/uploads/2017/04/Two-factor-768x1024@2x.webp 1536w, https://wadetregaskis.com/wp-content/uploads/2017/04/Two-factor-384x512@2x.webp 768w, https://wadetregaskis.com/wp-content/uploads/2017/04/Two-factor-192x256.webp 192w, https://wadetregaskis.com/wp-content/uploads/2017/04/Two-factor-384x512.webp 384w" sizes="(max-width: 1536px) 100vw, 1536px" /></a></figure>
</div>


<p>Versus what you see with &#8220;two-step&#8221;:</p>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><a href="https://wadetregaskis.com/wp-content/uploads/2017/04/Two-step.webp" data-wpel-link="internal"><img loading="lazy" decoding="async" width="1536" height="2048" src="https://wadetregaskis.com/wp-content/uploads/2017/04/Two-step.webp" alt="Screenshot of two-step authentication enabled in iOS account settings" class="wp-image-3900" style="width:768px" srcset="https://wadetregaskis.com/wp-content/uploads/2017/04/Two-step-768x1024@2x.webp 1536w, https://wadetregaskis.com/wp-content/uploads/2017/04/Two-step-384x512@2x.webp 768w, https://wadetregaskis.com/wp-content/uploads/2017/04/Two-step-192x256.webp 192w, https://wadetregaskis.com/wp-content/uploads/2017/04/Two-step-384x512.webp 384w" sizes="auto, (max-width: 1536px) 100vw, 1536px" /></a></figure>
</div>


<p>That &#8220;Get Verification Code&#8221; &#8220;button&#8221; is what you&#8217;re looking for. &nbsp;As you can see, it simply doesn&#8217;t exist with &#8220;two-step&#8221; authentication&nbsp;enabled.</p>



<p>The only solution &#8211; to allow your family members to download apps, purchase music / videos / books / etc, or pretty much do anything else on their iDevices &#8211; is to force the master account over to &#8220;two-factor&#8221; authentication.</p>



<p>To do this, you have to go to&nbsp;<a href="https://appleid.apple.com/" data-wpel-link="external" target="_blank" rel="external noopener">https://appleid.apple.com/</a>&nbsp;and turn off &#8220;two-step&#8221; authentication (which will require you to complete some stupid &#8216;security&#8217; questions). &nbsp;You cannot turn off &#8220;two-step&#8221; authentication from any of your actual iDevices&#8217; Settings apps.</p>



<p>Then, stupidly, you can&#8217;t actually enable &#8220;two-factor&#8221; authentication from that same website. &nbsp;That can only be done in the Settings app on one of your iDevices &#8211; by (in iOS 10.3 or later) going into Settings ➜ &lt;your name at the top of the list&gt;&nbsp;➜ Password &amp; Security.</p>



<p>There&#8217;s no way to enable &#8220;two-step&#8221; authentication anymore. &nbsp;And not having any form of two-factor authentication enabled is a very bad idea. &nbsp;So if any of your family&#8217;s accounts have &#8220;two-factor&#8221; authentication enabled, you basically have to switch&nbsp;to &#8220;two-factor&#8221; on <em>all</em> of them.</p>



<p>Which would be broadly fine, if Apple hadn&#8217;t made it so needlessly&nbsp;complicated, and the two systems so&nbsp;incompatible that their own software can&#8217;t figure out what&#8217;s going on.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/ios-family-sharing-users-cannot-mix-authentication-schemes/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3898</post-id>	</item>
		<item>
		<title>Stupid Swift error message #a bajillion and one</title>
		<link>https://wadetregaskis.com/stupid-swift-error-message-a-bajillion-and-one/</link>
					<comments>https://wadetregaskis.com/stupid-swift-error-message-a-bajillion-and-one/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Sat, 07 Jan 2017 19:27:42 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[clang]]></category>
		<category><![CDATA[Stupid Compiler Messages]]></category>
		<category><![CDATA[Swift]]></category>
		<category><![CDATA[What do you want?]]></category>
		<guid isPermaLink="false">https://blog.wadetregaskis.com/?p=3841</guid>

					<description><![CDATA[Input code: Push button. &#160;Expect results (or at least bacon). &#160;Get: Foo.swift:76:21: error: expected ',' separator .day: { String($0 + 1) }, ^ , Foo.swift:76:21: error: expected expression in list of expressions .day: { String($0 + 1) }, ^ Foo.swift:76:21: error: expected ',' separator .day: { String($0 + 1) }, ^ , Believe it or&#8230; <a class="read-more-link" href="https://wadetregaskis.com/stupid-swift-error-message-a-bajillion-and-one/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>Input code:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-disabled" data-code-block-pro-font-family="" style="font-size:.875rem;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><pre class="shiki light-plus" style="background-color: #FFFFFF" tabindex="0"><code><span class="line"><span style="color: #0000FF">let</span><span style="color: #000000"> componentsOfPotentialInterest = [Calendar.</span><span style="color: #001080">Component</span><span style="color: #000000">: ((</span><span style="color: #267F99">Int</span><span style="color: #000000">) -&gt; </span><span style="color: #267F99">String</span><span style="color: #000000">)](</span></span>
<span class="line"><span style="color: #000000"> .</span><span style="color: #001080">day</span><span style="color: #000000">: { </span><span style="color: #267F99">String</span><span style="color: #000000">(</span><span style="color: #0000FF">$0</span><span style="color: #000000"> + </span><span style="color: #098658">1</span><span style="color: #000000">) },</span></span>
<span class="line"><span style="color: #000000">)</span></span></code></pre></div>



<p>Push button. &nbsp;Expect results (or at least bacon). &nbsp;Get:</p>



<pre class="wp-block-preformatted">Foo.swift:76:21: error: expected ',' separator
 .day: { String($0 + 1) },
     ^
     ,
Foo.swift:76:21: error: expected expression in list of expressions
 .day: { String($0 + 1) },
     ^
Foo.swift:76:21: error: expected ',' separator
 .day: { String($0 + 1) },
     ^
     ,</pre>



<p>Believe it or not, Swift, blindly&nbsp;repeating your obtuse error messages does not help.</p>



<p>What it&#8217;s&nbsp;<em>trying</em> but as usual failing miserably to tell me is that Dictionary doesn&#8217;t have an initialiser that takes key: value pairs (my mistake for writing straight-forward, Python-like code). &nbsp;You have to&nbsp;use the dictionary literal syntax instead:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-disabled" data-code-block-pro-font-family="" style="font-size:.875rem;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><pre class="shiki light-plus" style="background-color: #FFFFFF" tabindex="0"><code><span class="line"><span style="color: #0000FF">let</span><span style="color: #000000"> componentsOfPotentialInterest: [Calendar.Component: ((</span><span style="color: #267F99">Int</span><span style="color: #000000">) -&gt; </span><span style="color: #267F99">String</span><span style="color: #000000">)] = [</span></span>
<span class="line"><span style="color: #000000"> .</span><span style="color: #001080">day</span><span style="color: #000000">: { </span><span style="color: #267F99">String</span><span style="color: #000000">(</span><span style="color: #0000FF">$0</span><span style="color: #000000"> + </span><span style="color: #098658">1</span><span style="color: #000000">) },</span></span>
<span class="line"><span style="color: #000000">]</span></span></code></pre></div>



<p>Now it merely complains about the expression being <a href="https://wadetregaskis.com/big-words-hurt-swifts-tiny-little-brain/" data-wpel-link="internal">too complex for its pathetic little brain</a>, rather than having no fucking clue what you&#8217;re doing to begin with.  Pick your utterly useless poison, I suppose.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/stupid-swift-error-message-a-bajillion-and-one/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3841</post-id>	</item>
		<item>
		<title>Big words hurt Swift&#8217;s tiny little brain</title>
		<link>https://wadetregaskis.com/big-words-hurt-swifts-tiny-little-brain/</link>
					<comments>https://wadetregaskis.com/big-words-hurt-swifts-tiny-little-brain/#comments</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Sat, 07 Jan 2017 19:04:02 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[clang]]></category>
		<category><![CDATA[Stupid Compiler Messages]]></category>
		<category><![CDATA[Swift]]></category>
		<category><![CDATA[What do you want?]]></category>
		<guid isPermaLink="false">https://blog.wadetregaskis.com/?p=3838</guid>

					<description><![CDATA[Foo.swift:75:49: error: expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions let componentsOfPotentialInterest = [(Calendar.Component, ((Int) -&#62; String))]( ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The fuck?]]></description>
										<content:encoded><![CDATA[<pre>Foo.swift:75:49: error: expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions
 <strong>let</strong> componentsOfPotentialInterest = [(Calendar.Component, ((Int) -&gt; String))](
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</pre>
<p>The fuck?</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/big-words-hurt-swifts-tiny-little-brain/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3838</post-id>	</item>
		<item>
		<title>ambiguous reference to member &#8216;joined()&#8217;</title>
		<link>https://wadetregaskis.com/ambiguous-reference-to-member-joined/</link>
					<comments>https://wadetregaskis.com/ambiguous-reference-to-member-joined/#comments</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Sat, 17 Dec 2016 19:23:51 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[clang]]></category>
		<category><![CDATA[Stupid Compiler Messages]]></category>
		<category><![CDATA[Swift]]></category>
		<category><![CDATA[What do you want?]]></category>
		<guid isPermaLink="false">https://blog.wadetregaskis.com/?p=3807</guid>

					<description><![CDATA[You can readily tell that Swift was created by a C++ fanatic, by its fucking obtuse error messages. ⤹ Me &#160; &#160; &#160;&#160;&#160; &#160; &#160; Swift compiler ⤵︎ In today&#8217;s episode of &#8220;what the fuck do you want, compiler?&#8221;, we tackle: foo.swift:186:39: error: ambiguous reference to member 'joined()' log.debug("\(thingies.joined(separator: ",&#160;"))") ^~~~~~~~ Swift.BidirectionalCollection:27:17: note: found this&#8230; <a class="read-more-link" href="https://wadetregaskis.com/ambiguous-reference-to-member-joined/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>You can readily tell that Swift was created by a C++ fanatic, by its fucking obtuse error messages.</p>



<p class="has-text-align-center">⤹ Me &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; Swift compiler ⤵︎</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="459" height="195" src="https://wadetregaskis.com/wp-content/uploads/2016/12/What-Do-You-Want-Rachel-McAdams-Ryan-Gosling-In-The-Notebook-Gif.webp" alt="&quot;What do you want&quot; scene from The Notebook" class="wp-image-3810" srcset="https://wadetregaskis.com/wp-content/uploads/2016/12/What-Do-You-Want-Rachel-McAdams-Ryan-Gosling-In-The-Notebook-Gif.webp 459w, https://wadetregaskis.com/wp-content/uploads/2016/12/What-Do-You-Want-Rachel-McAdams-Ryan-Gosling-In-The-Notebook-Gif-256x109.webp 256w" sizes="auto, (max-width: 459px) 100vw, 459px" /></figure>
</div>


<p>In today&#8217;s episode of &#8220;what the fuck do you want, compiler?&#8221;, we tackle:</p>



<pre class="wp-block-preformatted">foo.swift:186:39: error: ambiguous reference to member 'joined()'
       log.debug("\(thingies.joined(separator: ",&nbsp;"))")
                    ^~~~~~~~
Swift.BidirectionalCollection:27:17: note: found this candidate
 public func joined() -&gt; FlattenBidirectionalCollection&lt;Self&gt;
             ^
Swift.Sequence:27:17: note: found this candidate
 public func joined() -&gt; FlattenSequence&lt;Self&gt;
             ^
Swift.Sequence:18:17: note: found this candidate
 public func joined&lt;Separator : Sequence where Separator.Iterator.Element == Iterator.Element.Iterator.Element&gt;(separator: Separator) -&gt; JoinedSequence&lt;Self&gt;
             ^
Swift.Sequence:16:17: note: found this candidate
 public func joined(separator: String = default) -&gt; String
             ^
Swift.Collection:27:17: note: found this candidate
 public func joined() -&gt; FlattenCollection&lt;Self&gt;
             ^</pre>



<p>For context, &#8216;thingies&#8217; is an array of a custom type.</p>



<p>What the compiler wishes it could say, if it weren&#8217;t incompetent, is that every one of <code>Array</code>&#8216;s <code>joined</code> implementations are&nbsp;<em>conditional</em>. &nbsp;The one that I want is is the second last one, but it is only defined for <code>Array&lt;String&gt;</code> specifically. &nbsp;No other <code>Array</code> types.</p>



<p>Similarly&nbsp;<em>every other one</em> is conditional on the <code>Element</code> type within the <code>Array</code> being a specific type or protocol, none of which happen to apply to the types I&#8217;m using in my <code>Array</code>.</p>



<p>Now, my&nbsp;<em>intuition</em> is that since my type&nbsp;<em>is</em> <code>CustomDebugStringConvertible</code>, that Swift would know then how to convert my type to a <code>String</code> and then go from there. &nbsp;For better or worse, however, it does not. &nbsp;Instead you have to do it manually, e.g.:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-disabled" data-code-block-pro-font-family="" style="font-size:.875rem;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><pre class="shiki min-light" style="background-color: #ffffff" tabindex="0"><code><span class="line"><span style="color: #24292EFF">log.</span><span style="color: #6F42C1">debug</span><span style="color: #212121">(</span><span style="color: #22863A">&quot;</span><span style="color: #22863A">\(thingies.</span><span style="color: #6F42C1">map</span><span style="color: #212121">(</span><span style="color: #6F42C1">{ </span><span style="color: #1976D2">String</span><span style="color: #212121">(</span><span style="color: #6F42C1">describing</span><span style="color: #212121">:</span><span style="color: #6F42C1"> $0</span><span style="color: #212121">)</span><span style="color: #6F42C1"> }</span><span style="color: #212121">)</span><span style="color: #22863A">.</span><span style="color: #6F42C1">joined</span><span style="color: #212121">(</span><span style="color: #6F42C1">separator</span><span style="color: #212121">:</span><span style="color: #6F42C1"> </span><span style="color: #22863A">&quot;, &quot;</span><span style="color: #212121">)</span><span style="color: #22863A">)</span><span style="color: #22863A">&quot;</span><span style="color: #212121">)</span></span></code></pre></div>



<p>And you can probably tell from that alone that I&#8217;m very used to Objective-C, where it&#8217;s very easy to write what you intend <em>and</em> get the results you intend.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/ambiguous-reference-to-member-joined/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			<media:content url="https://wadetregaskis.com/wp-content/uploads/2016/12/What-Do-You-Want-Rachel-McAdams-Ryan-Gosling-In-The-Notebook-Gif.webp" medium="image" />
<post-id xmlns="com-wordpress:feed-additions:1">3807</post-id>	</item>
	</channel>
</rss>
