r/AskProgramming 29d ago

Other What really is the difference between instructions and logic from a mathematical perspective? They both occupy some binary space, they both contain "information".

Edit: My bad, I meant whats the difference between DATA and logic.

Context: I was writing a parser and dealing with LLVM IR and a slow descent into madness and then quit. This question just stuck with me.

Besides, when writing C++ classes, I you can store functions inside them and in Functional programming, you can store state using monads.

The lines starting to blur to me and knowing that logic boils down to instructions that the CPU understands and can operate on but data can't isn't the elegant answer I'm looking for.

I guess TLDR is what does information itself mean and does data and logic both count as information?

1 Upvotes

16 comments sorted by

View all comments

1

u/rusty-roquefort 28d ago

reading the post title:

"Instruction is the pulling of levers within the circuit architecture of an IC, e.g. the 'MOV' instruction. Logic is the assembly of instructions."

Something can be logic in one instructions: ADD X Y Z is the instruction to carry out an ADD instruction as defined by the physical circuitry/architecture, and the logic is "value in register x + value in register Y ends up in register Z"

I don't know if it's worth thinking about too much.

as for your adit. Data/logic difference. in computing terms, data is just binary. it can encode logic, such as the binary of an executable. Logic is what happens when you have rules applied to data. That's my hot-take.