summaryrefslogtreecommitdiff
path: root/content/blog/lang.md
blob: 125a2c0b6abb0ab1467453a698beb4cc98a05990 (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
---
title: Programming languages
date: 2024-07-24
---

<style>
span.pros {
	font-weight: bold;
}
span.cons {
	font-weight: bold;
}
</style>

I've recently read Drew DeVault's blog post, [How I decide between many
programming
languages](https://drewdevault.com/2019/09/08/Enough-to-decide.html). I
figured that I should write my own.

## C

<span class="pros">Pros</span>

-   [Simple](https://drewdevault.com/2017/01/30/Lessons-to-learn-from-C.html).
-   Interoperable with almost all other languages.
-   Direct access to system calls (well, for most system calls that I'd
    use, anyways).
-   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.
-   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.

<span class="cons">Cons</span>

-   Null terminated strings are objectively bad
-   Footguns do exist, and there isn't anything like borrow checking or
    automatic reference counting. These aren't strictly necessary, but
    are obviously helpful.
-   `errno` 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.)

## Go

<span class="pros">Pros</span>

-   Easy concurrency to write quick and relatively-scalable network
    services in.
-   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).
-   The best [garbage collector](https://go.dev/blog/ismmkeynote) I've
    seen in garbage-collected languages.

<span class="cons">Cons</span>

-   [The way zero values are handled are really
    bad](https://fasterthanli.me/articles/lies-we-tell-ourselves-to-keep-using-golang#all-or-nothing-so-let-s-do-nothing).
-   I'm not a fan of the automatic conversion between pointers and
    values.
-   [Go's error handling doesn't sit right with
    me](https://drewdevault.com/2014/06/07/Why-Go-error-handling-doesnt-sit-right-with-me.html).
    (I am *not* for exceptions, just to be clear.)

## Python

<span class="pros">Pros</span>

-   Code is easy to write.
-   Good-ish ecosystem.

<span class="cons">Cons</span>

-   Code is hard to maintain.
-   Really slow.
-   The global interpreter lock guarantees that threading is a pain.
    `asyncio` also sucks, and there aren't many libraries written for
    `trio`.
-   Dynamically typed, and no, mypy doesn't magically solve everything.

## Shell scripts

<span class="pros">Pros</span>

-   Good for gluing my desktop together, automating day-to-day tasks
    (both on the desktop and administering servers), and generating
    Makefiles.

<span class="cons">Cons</span>

-   A lot of bad advice on the web, and many people write disgusting
    scripts.
-   Arrays are not available in standard POSIX shell, and life is a pain
    without them.
-   A sufficiently complex shell script that interacts with the network
    *is* going to have remote code execution vulnerabilities.
-   I wanted to say "dynamic typing" here. "No typing" is probably more
    appropriate.

## Common Lisp

<span class="pros">Pros</span>

-   Really flexible. Best for, well, list parsing.

<span class="cons">Cons</span>

-   `#'i-still-dont-get-the-point-of-having-two-namespaces`.
-   Dynamic typing.
-   Quicklisp confuses me.
-   `))))))))))))))))))))))`

## Lua

<span class="pros">Pros</span>

-   Probably the best general-purpose scripting language.
-   Easy to use as an extension language.
-   Lua tables are really versatile.

<span class="cons">Cons</span>

-   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.)
-   Generally lacking ecosystem.
-   1-based indexing sucks.
-   I still prefer curly braces over `end`.

## JavaScript

<span class="pros">Pros</span>

-   None. I wouldn't use it if there are saner alternatives in browsers,
    e.g. if WASM could access the DOM.

<span class="cons">Cons</span>

-   Quirks surrounding automatic type conversion and equality testing.
-   I don't see any compelling reason for this language to exist outside
    web browsers, yet Node.JS exists.
-   NPM.