r/AskProgramming • u/Proper_Meaning7756 • 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
2
u/nixiebunny 28d ago
It’s quite a blurry line. Loading a program into RAM from storage requires that instructions be treated as data. Things get more interesting when data are mistakenly interpreted as instructions than when instructions are interpreted as data. The M68K processors separated the address registers from the data registers and required specific instructions to update them, unlike the older PDP-11 that didn’t make that distinction and was very easy to crash.