{"id":6235,"date":"2024-02-07T22:44:21","date_gmt":"2024-02-08T06:44:21","guid":{"rendered":"https:\/\/blackcap.name\/blog\/new\/?p=6235"},"modified":"2024-02-07T22:44:21","modified_gmt":"2024-02-08T06:44:21","slug":"why-swift-is-not-my-favourite-programming-language","status":"publish","type":"post","link":"https:\/\/blackcap.name\/blog\/new\/?p=6235","title":{"rendered":"Why Swift Is Not My Favourite Programming Language"},"content":{"rendered":"<p>It&#8217;s the libraries, stupid.<\/p>\n<p>The <a href=\"https:\/\/developer.apple.com\/documentation\/swift\/swift-standard-library\">standard Swift library<\/a> is laughably in-comprehensive. Things you can do in the standard libraries for Java, Python, PHP, C#, Ruby, and most other common modern programming languages just aren&#8217;t in there.<\/p>\n<p>What you are supposed to do, from what I gather, is to use the <a href=\"https:\/\/developer.apple.com\/documentation\/foundation\">Apple Foundation framework<\/a>. There are several problems with that:<\/p>\n<ul>\n<li>The framework is a hot mess. It got its start back in the 1990&#8217;s as part of the NeXT operating system, and has been incrementally hacked on ever since. The documentation is likewise a mess: incomplete, cryptic, and poorly-organized. It is fully part of the pattern that Apple products tend to be as programmer-hostile as they are user-friendly.<\/li>\n<li>The framework is still incomplete. Support for tasks as basic as doing buffered reads from an arbitrary text file on a line-by-line basis are absent from it. (At least I <em>think<\/em> they are absent; review the part about the documentation being a hot mess above.)<\/li>\n<li>The framework is an Apple-only thing. There is an ongoing effort to open-source the Foundation framework so that Swift programs can be more portable, but it is a work in progress.<\/li>\n<\/ul>\n<p>The bottom line is that Swift is not, in fact, the general-purpose programming language it is claimed to be. Unless one is writing native-mode GUI applications for Apple products, Swift really doesn&#8217;t make much sense.<\/p>\n<p>It&#8217;s a shame, as the core Swift language looks to be fairly well-designed. It <em>could be<\/em> a great general-purpose programming language if only it came with a decent standard library. Alas, that&#8217;s a bit like saying Mr. and Mrs. Lincoln <em>could have had<\/em> an enjoyable evening at Ford&#8217;s Theatre if only <em>that<\/em> hadn&#8217;t happened.<\/p>\n<p>I may <em>eventually<\/em> delve into Swift for such purposes, but as things currently stand, programming in <a href=\"https:\/\/kotlinlang.org\/\">Kotlin<\/a> with the Java <a href=\"https:\/\/docs.oracle.com\/javase\/8\/docs\/api\/javax\/swing\/package-summary.html\">Swing<\/a> platform allows me to develop GUI tools that run on my Mac, and I don&#8217;t have to deal with all the ugliness that is Apple&#8217;s native programming environment. Swing isn&#8217;t perfect, and its rough edges sometimes manifest, but it&#8217;s been good enough for my personal use.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s the libraries, stupid. The standard Swift library is laughably in-comprehensive. Things you can do in the standard libraries for Java, Python, PHP, C#, Ruby, and most other common modern programming languages just aren&#8217;t in there. What you are supposed to do, from what I gather, is to use the Apple Foundation framework. There are [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-6235","post","type-post","status-publish","format-standard","hentry","category-computers"],"_links":{"self":[{"href":"https:\/\/blackcap.name\/blog\/new\/index.php?rest_route=\/wp\/v2\/posts\/6235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blackcap.name\/blog\/new\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blackcap.name\/blog\/new\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blackcap.name\/blog\/new\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blackcap.name\/blog\/new\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6235"}],"version-history":[{"count":1,"href":"https:\/\/blackcap.name\/blog\/new\/index.php?rest_route=\/wp\/v2\/posts\/6235\/revisions"}],"predecessor-version":[{"id":6236,"href":"https:\/\/blackcap.name\/blog\/new\/index.php?rest_route=\/wp\/v2\/posts\/6235\/revisions\/6236"}],"wp:attachment":[{"href":"https:\/\/blackcap.name\/blog\/new\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blackcap.name\/blog\/new\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blackcap.name\/blog\/new\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}