Programming languages: "We are just a way to operate computers in a way that makes sense to humans."

Programming languages [takes a big joint hit]: "What if there were 5 kinds of nothingness?"

@olafurw

I'm throwing in another tiny, obscure, dark corner case .... undefined behavior ....

@olafurw [Snorts line]: And here are the rules for when different kinds of nothing are equal.
@almibe @olafurw "Also, some nothings are a type of nothing, while other nothings are a type of something, and other nothings are a type of everything."

@AT1ST @almibe @olafurw

Ok, now I'm thinking what the case is in Python.

Nothing: None, NotImplemented, Ellipsis
Null op: pass (or ...)
False and falsy: None, False, [], {}, "", 0, 0.0

@veronica @almibe @olafurw I don't know all of those, but yeah - "None" was my thought for the first, Falsy was the second, and JavaScript's null.

I don't know which of* Python's "Nothings" meet the requirement of the last one.

@veronica @almibe @olafurw Actually, now that I'm reminded of my posts here, it occurs to me that Ellipses is effectively the last "None type that is a type of everything.".
@olafurw Which ones?
1. when something isn't there
2. before something is there
3. when something is empty
4. the mathematical definition
5. when something is untrue
... (takes another hit) that's deep man ...
@teivel Nothing is there, nothing is supposed to be there, I put nothing there, we treat this something is as nothing,
@olafurw I forgot about NaN (and false is arguably not nothing??)
@teivel @olafurw Well, in Lisp, false is nothing, but not in Scheme, where false isn't nothing.
@olafurw @teivel we treat this nothing as something and we're not allowed to look at it
@olafurw @teivel Could you pass me the Nothing, please?
@olafurw @teivel i make APIs that interpret "nothing" as "please change this something to nothing", but "nothing" as "please do not change this", and it's the most obvious and straightforward interface I managed to come up with.
@olafurw @teivel but now I sometimes use a new, better designed programming language, which allows me to differentiate between "a nothing" and "no nothing", and this is groundbreaking.

Since people are liking this (for some reason), I felt like explaining the joke (for some reason).

In #JavaScript there are three distinct ways for a plain object to "not have x". There's certainly more if you add prototypes, getters, or worse, but that's on you then.

const a = { x: null };
const b = { x: undefined };
const c = {};

In most cases b and c are treated as the same case:

b.x === c.x; // undefined
JSON.stringify(b) === JSON.stringify(c); // {}

In some cases they're not:

Object.entries(a); // [['x', null]]
Object.entries(b); // [['x', undefined]]
Object.entries(c); // []

In some cases, the distinction matters. For example, if you have a function that takes a partial update to an object, it would be reasonable to take a to mean "set x to null" and to take c to mean "do nothing".

There is no reasonable way to interpret b, but I strongly believe it should be normalized to c, not a. Or throw a compile/runtime error. But certainly not turn undefined into null. That's two distinct kinds of nothingness in their own right, after all!

@teivel @olafurw
6. when something was there but we decided we don't need it anymore and then we try to do something with it anyway?
@teivel something should be there but we don't know what (I think this is what SQL NULL is supposed to model)
@olafurw Programming languages: "*hicc*, we're executable philosophy, biatch! [takes another hit]"
@temporal @olafurw *barely visible in a smoke cloud* can I borrow your nothing?
@olafurw who said you shouldn't study philosophy to be good at programming?
@olafurw the more I think about it, the more intriguing is the idea of having a programming language which would allow for the `Maybe<void>` return type. The implications would be interesting.
@tymwol @olafurw Rust already has that (though it's spelled 'Option<()>'). I believe they also implement the standard hash set as a HashMap<Key, ()> which makes the compiler throw away all the code dealing with values
@tymwol @olafurw a fucking idiot who has no idea what they are talking about
@cursedsql @tymwol @olafurw Sounds like it's time to close the book on philosophy and open the book on anger management.
@tymwol @olafurw Computer "science" does not belong in the engineering department. It is a branch of applied philosophy. Everybody knows this.

@olafurw I'm reminded of this story

> Said the master: “We have learned only that we have learned nothing, yet this is the root of wisdom.”

http://www.thecodelesscode.com/case/20

The Codeless Code: Case 20 Neither Yes Nor No

An illustrated collection of (sometimes violent) fables, concerning the Art and Philosophy of software development

@olafurw That's just capturing reality with more accuracy than normal people tend to capture, because most of those cases don't often happen they are still actually relevantly different.

1. There's toilet paper
2. There's no toilet paper, the roll is empty
3. The roll is gone, but the roll holder is empty
4. There is no place to even put a roll if you had one, but there is a toilet
5. The toilet is being rebuilt and the place to mount the roll holder does not currently exist

Most people only care about 1 or not 1 when they ask "is the toilet paper out"... but we kinda need the other details, so we don't try to screw a roll holder into nothingness and crash the system.

@dascandy @olafurw So,

6. There's a roll of toiletpaper floating in a vast empty void.

@lbheuschkel @dascandy @olafurw

7. There's toilet paper, but the dog just put it in the toilet.

(Sorry, I know nothing about programming, but a surprising amount about toilet paper.)

@ravenbait @lbheuschkel @dascandy @olafurw The Andrex puppy sneaking into the cubicle by a back door and crapping on your lap was an important metaphor on my concurrent programming course.
@lbheuschkel @dascandy @olafurw
A roll of toilet paper appears spontaneously as a statistical fluctuation of the quantum vacuum. We could call this a Boltzmann Bog Roll.
@lbheuschkel @dascandy @olafurw
7. Consider a spherical roll of toilet paper in a vacuum.
@dascandy @olafurw 6. You requested toilet paper, but I am a teapot.

@dascandy @olafurw I also wouldn't say it's that people don't capture that info; it's that (generally) a huge amount of information is captured nonverbally.

Customer: "Can I get some toilet paper?"
Answer 1: uh yeah, in the toilet *points*
Answer 2: One sec, I'll bring some more over
Answer 3: someone just used the last roll, sorry
Answer 4: can't you read? *angrily points at "closed for maintenance" sign*
Answer 5: *in hi-viz and hard hat* what the hell are you doing on my construction site? Get out!

We infer the type of zero from context

Answer 6: sir, please put the teapot back on the display, I'm going to have to ask you to leave the store

@dascandy @olafurw there's toilet paper but no roll.

That's before "2 people put a roll on at the same moment" and "someone knocked down the toilet whilst in use" and all the other stuff that does the real damage for correctness because most programmers are still taught in a serial way so just don't see the problem.

@dascandy @olafurw You're making it sound like some of my autistic son's responses to instructions are a QA/debug issue.
@GeneralStrike my thought.
When I try to explain new things to my son, I'm at about that level of detail.
@dascandy @olafurw
@dascandy @olafurw All these responses, and not one person has defined a toilet roll yet!
I mean, how many times does the toilet have to roll anyway? What if there's a user "in place" when it rolls?
@dascandy @olafurw There is a roll of toilet paper, but someone else is holding on to it. You don't know when that person will let go of it, if ever.
@dascandy @olafurw Gives a whole new meaning to the “bottom” type.
@olafurw From "makes sense to humans" I'm inferring that a lot of programming language designers see the world in unique ways.

@drgroftehauge @olafurw

Yes, precise and interesting ways. I don't personally trust the humans who want things to be understandable to humans but haven't thought the concept through. This is how you get "AI prompt engineers".

@drgroftehauge
@olafurw
They are trying to talk with rocks carrying lightning after all.
@olafurw having read Lem's _Cyberiad_, I know about the great Cerebron's discovery of the 3 different types of nonexistence: mythical, chimerical, or purely hypothetical. (Spoiler: there is at least one other type!)
A good online introduction is available online, but I recommend reading The Dragons of Probability.
https://tentoinfinity.com/2013/05/15/the-dragons-of-probability-by-stanislaw-lem/
The Dragons of Probability by Stanislaw Lem

If you like The Hitchhiker’s Guide to the Galaxy, there’s a fair chance you’ll like today’s story. First off, this doesn’t read like a work that has been translated. I assume Lem’s original p…

Ten to Infinity
@olafurw Programming languages; "Before we begin, have you read Sartre's 'Being and Nothingness'?"

@olafurw so:
X=null
X=0
X=0.0
X=""
X={ }
X=[ ]
exists(X)=false

So much fun 😁

@olafurw meanwhile C: "I don't know man... 0 == NULL == FALSE... isn't that enough?"
@olafurw I prefer prompt engineering over coding it makes everything so much easier /s
@olafurw
Whenever I write an expression to test if a variable is empty.
https://youtu.be/nJXmZwClW1A
Spoon Snake - 'am I nothing?' - Noel Fielding's Luxury Comedy

YouTube
@olafurw as they say in Assassin's Creed: "Nothing is true; everything is permitted"
@olafurw Javascript: hold my beer.
@olafurw "Let's say we have a type of data that can only contain numbers. And lets store the special value of 'this is not a number'. Now, if you have a number that's not a number, is it equal to another number that's not a number?"
@olafurw @cstross oh man, I object! *endless stoner laughter*
@olafurw so do you think programming language designers are nihilists?
@olafurw Meanwhile, humans: [philosophy], [theology], [spirituality]…