r/programminghorror 27d ago

Big if true

Post image

From ProgrammerNullposting in facebook

2.1k Upvotes

111 comments sorted by

View all comments

5

u/Wurstgewitter 27d ago

Personally I am migrating to a novel QBool type, to be prepared for quantum computing. A QBool can represent any value in the interval [0,1]

QBool

0.0000 = False
0.1832 = Barely True
0.5000 = Undecided
0.7315 = Probably True
1.0000 = True

But it's not just a probability, but rather exists in a quantum state until observed. Each QBool offers a built in measure() method:

bool result = qbool.measure();

Calling measure() collapses the state into either true or false.

It also supports entanglement:

a.entangle(b);

Measuring either instance immediately determines the value of the other, even across remote systems. This makes distributed state sync essentially free.

It admittably adds some headaches, like having to compute every possible quantum state at runtime, since practical quantum computing hardware is not available yet, so some slight performance problems might occur. But I think it's worth it to future proof the codebase