> Use a statically typed language with algebraic data types.
> Use zero and empty string as special "unknown" values.

@wolf480pl @ayo don't remember off the top of my head, but I've seen some libraries still return -1 on failure even when the convention is to use exceptions.

@normandy @ayo

Reminds me of C++ lol :D

So you're supposed to do RAII, right? Eg. if you have a file stream object thingy, it should open the file in constructor. And if constructor fails, it should throw exception, right?

Except even C++ standard library doesn't do that. Eg. fstream's constructor silently ignores errors, as do most of its methods, and you need to explicitly call .good() or sth to check for errors.

@wolf480pl @ayo c++ is full of strange quirks here and there lol.

I know some don't like exceptions in C++ but this is just strange.

@normandy @ayo
C++ is confused how things should be done.
There are multiple ways to do everything, and different parts of standard library follow different conventions.

good read btw:

@wolf480pl @ayo other than the standard library part, it seems to still be relevant even in "modern C++" (admittedly though I'm not that well versed in the C++ ecosystem).

Come to think of it, "modern" C++ is like 80-90% STL changes. Not much is done to the language itself.
@wolf480pl @ayo and of course you can still do things the "old" way just cause.

@normandy @ayo
IMO the STL changes only made things worse, because the old parts stayed old...

@wolf480pl @ayo yeah like I said you can still do things the "old" way. They pretty much just more stuff on top.

@normandy I mean, you often *have to* do things the old way because nobody bothered to rewrite old parts of STL the new way.

Also, C++03 was the peak of C++

@wolf480pl it's still hilarious that there's like a zillion string libraries since std::string hasn't fixed its shortcomings.

@normandy IMO, every large C++ project should have its own implementation of standard library's functionality under util/. Own classes for strings, files, sockets, and whatnot.

Sign in to participate in the conversation

A lonely little town in the wider world of the fediverse.