summaryrefslogtreecommitdiff
path: root/lang.html
blob: b7feb3662c5130e4d9b20b2c98f13bbb25a4ec93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>Programming languages</title>
	<link rel="stylesheet" href="./style.css" />
	<link rel="icon" href="./favicon.ico" sizes="any" />
	<!--link rel="icon" href="./icon.svg" type="image/svg+xml" / -->
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta name="theme-color" content="#241504" />
	<meta name="color-scheme" content="light dark">
<style>
span.pros {
	font-weight: bold;
}
span.cons {
	font-weight: bold;
}
</style>
</head>
<body>
<header>
	<h1>Programming languages</h1>
</header>

<article>
	<p>
	I've recently read Drew DeVault's blog post, <a href="https://drewdevault.com/2019/09/08/Enough-to-decide.html">How I decide between many programming languages</a>. I figured that I should write my own.
	</p>

	<h2>C</h2>
	<p><span class="pros">Pros:</span></p>
	<ul>
		<li>
			<a href="https://drewdevault.com/2017/01/30/Lessons-to-learn-from-C.html">Simple</a>.
		</li>
		<li>
			Interoperable with almost all other languages.
		</li>
		<li>
			Direct access to system calls (well, for most system calls that I'd use, anyways).
		</li>
		<li>
			Good ecosystem, and most packages I'd use are in my system's repositories. Using the system package manager is the only way to sanely manage dynamically linked libraries.
		</li>
		<li>
			Flexible macro system. Yes, there are pitfalls, but it's flexible enough for my needs and it's not that hard to remember to add parenthesis.
		</li>
	</ul>
	<p><span class="cons">Cons:</span></p>
	<ul>
		<li>
			Null terminated strings are objectively bad
		</li>
		<li>
			Footguns do exist, and there isn't anything like borrow checking or automatic reference counting. These aren't strictly necessary, but are obviously helpful.
		</li>
		<li>
			<code>errno</code> is bad. (My opinion holds that the proper alternative is multiple return values, though I also believe that the langugage shouldn't make it easy to accidentally ignore errors, nor should error handling have too much boilerplate.)
		</li>
	</ul>


	<h2>Go</h2>
	<p><span class="pros">Pros:</span></p>
	<ul>
		<li>
			Easy concurrency to write quick and relatively-scalable network services in.
		</li>
		<li>
			Well-designed standard library, and a generally good ecosystem (with an non-insane language-specific package manager, which I find acceptable since Go libraries are statically linked).
		</li>
		<li>
			The best <a href="https://go.dev/blog/ismmkeynote">garbage collector</a> I've seen in garbage-collected languages.
		</li>
	</ul>
	<p><span class="cons">Cons:</span></p>
	<ul>
		<li>
			<a href="https://fasterthanli.me/articles/lies-we-tell-ourselves-to-keep-using-golang#all-or-nothing-so-let-s-do-nothing">The way zero values are handled are really bad</a>.
		</li>
		<li>
			I'm not a fan of the automatic conversion between pointers and values.
		</li>
		<li>
			<a href="https://drewdevault.com/2014/06/07/Why-Go-error-handling-doesnt-sit-right-with-me.html">Go's error handling doesn't sit right with me</a>. (I am <em>not</em> for exceptions, just to be clear.)
		</li>
	</ul>


	<h2>Python</h2>
	<p><span class="pros">Pros:</span></p>
	<ul>
		<li>
			Code is easy to write.
		</li>
		<li>
			Good-ish ecosystem.
		</li>
	</ul>
	<p><span class="cons">Cons:</span></p>
	<ul>
		<li>
			Code is hard to maintain.
		</li>
		<li>
			Really slow.
		</li>
		<li>
			The global interpreter lock guarantees that threading is a pain. <code>asyncio</code> also sucks, and there aren't many libraries written for <code>trio</code>.
		</li>
		<li>
			Dynamically typed, and no, mypy doesn't magically solve everything.
		</li>
	</ul>


	<h2>Shell scripts</h2>
	<p><span class="pros">Pros:</span></p>
	<ul>
		<li>
			Good for gluing my desktop together, automating day-to-day tasks (both on the desktop and administering servers), and generating Makefiles.
		</li>
	</ul>
	<p><span class="cons">Cons:</span></p>
	<ul>
		<li>
			A lot of bad advice on the web, and many people write disgusting scripts.
		</li>
		<li>
			Arrays are not available in standard POSIX shell, and life is a pain without them.
		</li>
		<li>
			A sufficiently complex shell script that interacts with the network <em>is</em> going to have remote code execution vulnerabilities.
		</li>
		<li>
			I wanted to say "dynamic typing" here. "No typing" is probably more appropriate.
		</li>
	</ul>


	<h2>Common Lisp</h2>
	<p><span class="pros">Pros:</span></p>
	<ul>
		<li>
			Really flexible. Best for, well, list parsing.
		</li>
	</ul>
	<p><span class="cons">Cons:</span></p>
	<ul>
		<li>
			<code>#'i-still-dont-get-the-point-of-having-two-namespaces</code>.
		</li>
		<li>
			Dynamic typing.
		</li>
		<li>
			Quicklisp confuses me.
		</li>
		<li>
			<code>))))))))))))))))))))))</code>
		</li>
	</ul>

	<h2>Lua</h2>
	<p><span class="pros">Pros:</span></p>
	<ul>
		<li>
			Probably the best general-purpose scripting language.
		</li>
		<li>
			Easy to use as an extension language.
		</li>
		<li>
			Lua tables are really versatile.
		</li>
	</ul>
	<p><span class="cons">Cons:</span></p>
	<ul>
		<li>
			The lack of real threads is a huge pain. No, coroutines are not threads. (Though, no other scripting language has sane multithreading, so... fair enough.)
		</li>
		<li>
			Generally lacking ecosystem.
		</li>
		<li>
			1-based indexing sucks.
		</li>
		<li>
			I still prefer curly braces over <code>end</code>.
		</li>
	</ul>


	<h2>JavaScript</h2>
	<p><span class="pros">Pros:</span></p>
	<ul>
		<li>
			None. I wouldn't use it if there are saner alternatives in browsers, e.g. if WASM could access the DOM.
		</li>
	</ul>
	<p><span class="cons">Cons:</span></p>
	<ul>
		<li>
			Quirks surrounding automatic type conversion and equality testing.
		</li>
		<li>
			I don't see any compelling reason for this language to exist outside web browsers, yet Node.JS exists.
		</li>
		<li>
			NPM.
		</li>
	</ul>
</article>

<footer>
	<ul role="list">
		<li><a href="./">Home</a></li>
		<li>Runxi Yu</li>
		<li><a rel="license" href="./pubdom.html">Public Domain</a></li>
	</ul>
</footer>
</body>
</html>