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

@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.

Β· Β· Web Β· 0 Β· 0 Β· 0
Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!