thinking about how there's a nontrivial set of programmers who are gungho about both "if you use after free that's your fault for not programming better you inept clown" AND "no i need the computer to tell me not to call an integer like it's a function", simultaneously


according to hacker news, the ideal programmer can keep the entirety of a massive complex system in their head all at once and instantly analyze all possible data flow paths, but is a total fucking idiot when it comes to basic local tasks like adding numbers together

Β· Β· Web Β· 3 Β· 4 Β· 16

once again fondly recalling the guy designing a DSL who insisted on static types because how can you possibly program without them, but refused any kind of static null checking because c++ doesn't have that and it works fine so it must be unnecessary

@eevee still amazed that most people don't consider null a violation of static typing

@unascribed that drives me up the wall but honestly the explanation seems to be that c++ programmers think "static typing" is literally "whatever c++ does", similar to how they define OO

@eevee @unascribed tbf try to use an uninitialized std::unique_ptr and it will casually scream at you about it tho. Also, new and delete do not exist. They do not. No.

@Archivist @unascribed love to use languages where half the basic functionality is considered gravely dangerous

@Archivist @eevee @unascribed ah yes and every programmer must learn all of the many disguised ways of calling constructors, like "list::emplace_back"

sorry I just learned that one this week and any perceived hostility was directed at C++, not you :)

@fraggle Don't worry haha, I don't take things against myself. You have several ways to actually construct stuff in C++ and most courses are outdated or given by people that did Java for their entire life

@eevee @unascribed
It's a scam, don't believe any of it. Real static typing has variant types like Either and Maybe, as well as a support for Monads and typeclasses, with an embedded prolog interpreter to resolve them at compile time.
Ask for genuine Haskell software.

@eevee This is what I enjoy in Crystal: Nil is its own type and everything is a tagged union

@eevee i would ask for a β€œc++: a fractal of bad design” post but that would be giving it the credit of saying it was designed

@r4v5 @eevee c++ has had too much design imo, you get big systems with so much design for the 1% that they’re garbage for the 99%

@eevee without types, not calling an int like a function is not a local task.
It's at least as hard as not dereferencing null - you need to analyze all data flows to figure out where the variable came from, to determine if it could not be a function pointer.

With null, at least you can easily guard against its dereference at runtime. But dynamically checking if something is a function pointer would require heavy linker hackery.

@wolf480pl calling None in python throws an exception. calling NULL in c is a likely security issue

also i'm not aware of any dynamic language that doesn't let you identify a function (though c, being fairly weakly-typed, would let you store a function pointer in an integer and vice versa)

@eevee no I mean in C without types, or in assembly.

You can

void* x;

if (x) {
// hey x is not null

but you can't determine if a void* is a function pointer.

Obviously in dynamic languages you have runtime type information so you can introspect anything and everything.

Anyway, I think null sucks, and nothingness should be properly expressed in a type system.

@eevee My soon-to-be-ex manager spent half an hour trying to convince me that needing time to recover from forced context switching was a problem unique to me.

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!