rants and shitposting
Content warning: strong language and strong opinions. I’m not here to convince you. You may say that’s totally my “skill issue”; but rants are rants – these are subjective.
- Declare an array of type
T
and lengthn
- CMake - it’s like learning another exotic language
- FOSS vs proprietary
- AI generated banner image
- Namespaces, please don’t omit them…
- XyzSky and Xyzreads, history just repeats
- Can you tell me how?
- C++ compiler (GNU) error messages are trash.
- 80 chars text width
- the extent of hackability
- indirections:
- (vim rant) I can’t fucking delete, I can’t fucking paste.
- latex
- license
§§§
Declare an array of type T
and length n
- C
T name[n]
- Rust
let name:[T;n]
- Go
var name[n]T
- Zig
var name: [n]T
- Hare
let name: [n]T
- Java
T[] name = new T[n]
§§§ CMake - it’s like learning another exotic language
like, wtf?
target_compile_options(tutorial_compiler_flags INTERFACE
"$<${gcc_like_cxx}:$<BUILD_INTERFACE:-Wall;-Wextra;-Wshadow;-Wformat=2;-Wunused>>"
"$<${msvc_cxx}:$<BUILD_INTERFACE:-W3>>"
)
§§§ FOSS vs proprietary
- FOSS: it’s unfunded voluntary works and we can’t care too much to improve “non-critical” stuffs like UI/UX
- Proprietary: we are subject to capitals so we will spend xyz human-hours to deliberately fuck it up
Please donate to FOSS.
>
§§§ AI generated banner image
Just came across this article on fediverse. https://embeddedor.com/blog/2024/09/28/one-simple-and-rewarding-way-to-contribute-to-the-linux-kernel-fix-coverity-issues/
NOTE: this is not a comment on the cited article itself. I’m only talking about the way it uses a AI generated Tux banner image.
Like, wtf is this banner image… I get it that you want a copyright-free image as a banner… fair, I’m not gonna debate whether you need a banner in the first place1 but here I have a better solution:
Instead of serving the static image on your server, you simply embed the origin prompt as an HTML extension:
<ai>
<description> This is an alt text </description>
<prompt> Cartoon style, linux Tux, terminals, code, programming </prompt>
<model> Waifi-diffusion </model>
</ai>
For those who are interested, they can use a browser plugin to feed the prompt to a online model and embed the generated image in place.
§§§ Namespaces, please don’t omit them…
Generally speaking I like the idea of namespaces, the absense of which can be a real pain C’s ass when you have a larger codebase. That said:
When I see this while reading a unfamiliar codebase, my blood pressure raises. For me especially:
- I normally don’t use IDEs (or by extension, LSPs)2 so I can’t just see the definition of a function/variable just by clicking them.
- Instead I would grep for filenames and strings.
For the sake of line width, use
shorter alias!!!;
The notation of using namespace xyz;
is an obfuscation.
§§§ XyzSky and Xyzreads, history just repeats
And again, and again, you are fed up with some SNS’s bullshit and decide to move to another. Yet you are moving from one tech-giant spyware to another tech-giant spyware.
There is no self autonomy in XyzSky or Xyzreads, it’s just another centralized capitalist shitdump that pretends “federation / self-host / opensource” or whatever. THEY DON’T GIVE A FUCK ABOUT NOTHING BUT YOUR DATA.
§§§ Can you tell me how?
it’s quite often that I want abc features from a software I use; while I search the issues I find a “feature requrest” issue where others asked for exactly the same thing, and that issue is closed as “complete”, and the maintainer says this is resolved/added in newer versions. And? How the heck do I use it then? I know this may be a quirk that may not deserve much documentation. But you fixed it, how do I use it???? And often I have to read through the commit and read the code to understand what steps are needed to enable that feature.
It would be absolutly charming if, after completing a feature request, or resolving an issue, you kindaly leave a comment in the thread like:
“now you can use it by <insert instructions>”
§§§ C++ compiler (GNU) error messages are trash.
Don’t tell me it’s a skill issue. The error message often reveals nothing about the error itself, but the consequence caused by the error. Like what, I have to reverse engineer the result into the cause? What do I need you for then??
gcc is pretty much the same but C is a much simpler language and in most cases I know what I’m doing and I know what’s going wrong.
§§§ 80 chars text width
the 80 chars text width rule came punchcards and early terminals. And it’s
pretty ergonomic IMO. For plaintext emails this number is 72 chars (to leave
space for terminal email client UIs and quotation marks >
).
I still stick to this number (or 100 chars for rust or c++) even with 1080p/2K/4K monitors. Now this is awkward: on a 24 inches monitor, the screen width doesn’t fit 3x windows without wrapping the lines (with a readable text size). I have to either get a bigger (wider) monitor, or use smaller font size (+higher resolution), or set my text width lower (like, 72 chars). Of course I have a second monitor, but having 2x 24 inches monitors is also awkwards because neither of the monitors sits in the middle, so I have to look aside all the time. (My current configuration though, is I have on monitor in front me me and the secondary on the side).
It may make sense to get a “ultra-wide” monitors instead..
alt text: screenshot of three terminals tilled horizontally, each having one line of 80 chars. The lines are wrapped because the screen is not wide enough for ~240 chars.
§§§ the extent of hackability
There are point release + binary based systems (like debian) where you have a box that’s guaranteed to work, but no bleeding edge software.
There are rolling release + source based systems (like gentoo and LSF) where you have the latest software and the ultimite freedom to hack the system. But you then ask yourself, is this all worth it? … The answer is no if your only goal is to get things done.
And there are, btw, the archlinux, the rolling release+ binary based (not including AUR) system, which, many claim to sit on the sweet spot between the two extremes. You have the (almost) always up-to-date software, you don’t worry about compiling basic stuffs (packages in the core repos) and you have the AUR.
If you think I’m writing this to praise the arch you are wrong. This panel is called the “rants” and here I rant:
The other side of “have the bests of both worlds” is that you also have the worst of both worlds. You are inviting troubles by sitting in the middle:
If newer verisons of software A break software B and C as their dependency; B upstream follows up the breaking changes while C doesn’t – then it’s mathmatically impossible to have all three of them up to date. I see in some cases the package matainers manually apply unmerged upstream code (not sure if it’s common practice for package maintainers to come up with their own patches, but I’m sure I’ve seen some).
– Okay, I’ll just trust the core package maintainers…fine. But this is triple nasty when it comes to AUR, where users create their own recipe to build and install the software.
/// TODO TODO TODO TODO TODO TODO TODO
§§§ indirections:
All problems in computer science can be solved by another level of indirection" (David Wheeler)
– “…except for the problem of too many layers of indirection.” (Kevlin Henney)
I just want to echo on this, from a FOSS contributor’s point of view.
When a project starts it serves a specific, concrete goal and every thing was
implemented straight forward (unless you start with one of those infamous3
design patterns :frown
).
Then you have more problems to solve, more features to implement, more hardware to support … and you will need abstractions (indirections) to sort things out at a higher level, before you are are overwhelmed. But the problem is that, the design of the abstraction layers doesn’t commute well. Now I come to your project and try to contribute code (say, fix a small bug). But there are already too many layers of non-trivial indirections that prevents me from quickily digest your code or writing code under the same doctrines.
Like, I see a bug, and I already have an idea what exactly is going wrong.
Without prior knowledge on the codebase, I would do some quick “reverse
engineering” by 1) adding several printf
s to have a rough idea of the code
paths and 2) empirically grep a few keywords (typically function names) to
find interesting stuffs… And it’s painful when there are bad abstractions.
(MAYBE TODO, MAYBE NOT)
§§§ (vim rant) I can’t fucking delete, I can’t fucking paste.
Neovim comes with good system clipboard support out of the box, nice.
Here is the problem: I copied something into my clipboard (either from system, or just from vim buffer, I don’t care, it’s simply yanked). And I want to replace a piece of text with what I’ve copied. (say, something inside of brackets).
First I delete the existing text, e.g. with di(
or ri(
or ci(
or something,
the old text is gone, good, now your clipboard is overriten because all these
commands are “cut” instead of “delete”. And all documentations tell you to use a
“black home register”. e.g.
"_di(
to specify d
should use register _
that does nothing. And for fuck’s
sake these two symbols are painful to type on a keyboard (pinky finger, corner
position, no frequent usage). For me typing "_
takes me 2x time than typing
di(
.
And for fuck’s sake, there is no native vim normal mode command that “just
fucking delete it”. Every delete is a fucking cut. (x
does that but it only
works on single letter under cursor).
Good, now you somewhat deleted the old text without overwriting your clipboard. Now you want to paste into a pair of brackets, or quotation marks. Say you are now in normal mode and you want:
""
to
"this was in my clipboard"
Where do you place your cursor before you press p
?
"" or "" ?
^ ^
I tell you, if your copied content is a whole line, e.g. you copied via yy
or
dd
, neither position would work because it starts a newline
""
this was in my clipboard
The solution (?) is that you yank with a till the end of line
command, e.g.
instead of yy
or dd
, you nevigate to the beginning of the line and type Y
or D
. This sucks.
§§§ latex
latex: expecting a curly bracket }
me: type }
latex: unexpected }
§§§ license
YOU ARE NOT OPEN SOURCE UNLESS YOU INCLUDE AN OPEN SOURCE LICENSE.
“Source code available” doesn’t make open source. Include a license, allow others to reuse and adopt and modify.
-
I reserve my opinion that banner image is 99% of the time POINTLESS, if not a total waste of resources. ↩︎
-
Even with a language server, it often can’t correctly handle library functions well; Worse if you have compile time generated headers etc., e.g. protobuf, or AspectC++. But that’s another topic. ↩︎
-
for example, you create a factory that creates a factory that creates a meta-tool that creates a thing, before you even try to implement the thing itself. e.g. Modern Software Development Summarized (Why I Hate Frameworks), Benji Smith. https://factoryfactoryfactory.net/ ↩︎