@neauoire is there any particular reason why you're using C89 instead of something more recent? Also if you don't mind me asking, how long have you been using C because that looks really clean.

@yakub started learning C about a year ago, but I've been pretty intense about it. I've tried to write a bit of C everyday since.

I chose C89 because it's the most portable, a lot of the work I do I port to plan9 since one of my workstations runs on it. I find C89 crosses over more easily.


@neauoire ah, that makes sense. I haven't considered less popular platforms.

I love how nice your tools are, it makes me want to start looking for things I can write in C myself. I learned it a while back but every project I wanted to work on has been easier to implement in other languages since I don't have much incentive to aim for low power usage.

@yakub yeah it's hard to learn if you don't see a direct impact. But C is a great language, it's so simple, and the toolchain pretty much works everywhere which makes it a lot of fun.

I was really pissed off when I realized that my tools only worked on top-of-the-line modern hardware and OSes, I didn't want to encourage people to buy new hardware, so I changed my workflow to target 30 years old platforms as an experiment. And it was painful, but rewarding.

@neauoire you're right, I wish that mindset was more common.

C is definitely very elegant and makes you feel like you have almost full control over the hardware. Most of the code I write outside of work is only really meant to be used by myself and isn't useful to others so I just end up using what's fastest to write (usually Python or JS these days).

@yakub I started to kind of see this sort of .. experiment as hobby programming because while it's programmatically efficient, it's not efficient-efficient, I mean like, it's not practical in today's realities since it's a lot more work for seemingly no reward.

@neauoire @yakub what really bugs me in C is the amount of work it takes to support utf8... essentially impossible with the stdlib. plus lots of functions you'd actually want in the stdlib are broken, unsafe and their replacements are a gnu extension or somesuch, meaning non portable 🙁

@reto @neauoire if I needed UTF-8 support I would probably be using Rust but I have the same issue as with C - it's slow to write (because of its complexity not simplicity). On top of other issues.

@yakub @neauoire I like go, it's simple from a code syntax perspective

@reto @neauoire I can't really relate because it has some really questionable design (in my opinion) while differing very little from C. It solves very few problems that are inherent to C (other than memory safety) and introduces many of its own.

@yakub proper utf8, easy "threading" compile time safety for say array bounds, hashmap, actually sane stdlib handling things like mail, encodings, http etc?

I could go on. Oh and all os garbage collected in an efficient manner, so exactly what I want.

I don't fo hardware so the runtime/gc don't bother me
@yakub (also I shouldn't try to type while I'm walking around)

@reto I suppose you're right, it has a lot that C doesn't but I'd just use Python in every instance unless I wanted top multi-threaded performance.

@reto you also just have to type everything over and over because it lacks generics. Filtering or mapping an array is too common to write a loop every time considering there's no benefit to doing that. This gets much more severe in big projects like Kubernetes.

@yakub true but they are addressing that currently
@yakub I love python for data analysis stuff (pandas, numpy, scipy...) but I have to say that the dynamic nature of it is really annoying for real programs simply because I want to catch errors at compile time, not runtime...

If you do a large refactor in python shit breaks everywhere in a whack a mole manner, whereas in go the compiler would pretty much point out the errors prior to you even being able to start the app

@reto right, Mypy helps with that a lot though. No language is perfect 😔

@yakub sure, but then it's not python anymore and looks shitty because it lacks a sane syntax for the types (they got bolted on)

@reto even though you might think it looks "shitty" I barely ever write Python without typing hints anymore. Even if I'm not running it against Mypy continuously it just serves as documentation. Typing hints are definitely a net gain for the language.

@yakub true in some ways. I just prefer to use a proper strongly typed and statically typed language in that case (may have mixed up the terminology there)

@reto that's definitely more desirable.

I'm definitely biased because I spent a week or two trying to make sense of some horrible codegen hidden inside the Kubernetes source. If they couldn't find a better way to provide a strongly typed API than using a home-brew code generation script then there's probably no way to do it before generics arrive (if ever).

(I think the terminology is correct)

@yakub well to be fair most projects aren't k8 and are actually very readable if structured correctly.

But I do agree that not having generic max, min, filter etc is annoying.

After a while you are simply used to some of the patterns so it doesn't bother you very much.
Each language has it's pros and cons. If you need to do generic, dynamic stuff go is probably the wrong tool for the job and stuff like ruby/python shine.

@neauoire word.
It's a sad reality we live in. Especially in terms of GUI development, where it seems like there's nothing else than Electron these days.

@neauoire i found a bug where if i move a window over the top of the dotgrid window it doesn't redraw.
this patch fixes it.

@james Thanks, but I don't want to redraw all the time unless something has changed. I don't mind the overpaint that much.

@neauoire i made it just repaint the window when it gets uncovered by redrawing on expose events. it doesn't have much of an impact on cpu usage. 0.7% -> 1.2% when moving a window over it.

@james Oh! Perfect, I like that better. I will implement when I get back to the boat in 2 days ✊

@neauoire cool :) it's always nice to find a bug that i know enough c to fix :/
@neauoire rather than the strange bugs i was having the other day where my program was crashing at malloc() even though i had plenty of space left

@neauoire on openbsd clang, -fsanitize=address isn't a thing and -fsanitize=unknown appears to be either broken or it requires more linking. openbsd also needs -I/usr/local/include added to the compile command. maybe make the release version the default in the build script? :)

@neutral I'd expect everyone to have a look at the build script and adapt it to their needs, I can make the fast build the default, this is still a work in progress

Sign in to participate in the conversation

Merveilles is a community project aimed at the establishment of new ways of speaking, seeing and organizing information — A culture that seeks augmentation through the arts of engineering and design. A warm welcome to any like-minded people who feel these ideals resonate with them.