The line of code seems basic, even for BASIC. There aren’t any variables. It uses a GOTO instead of a more elegant loop. How could something so short and simple generate such a complex result? What can this one line—“10 PRINT,” to use the authors’ shorthand—teach us about software, and culture at large?
I find Computer Scientists to be a fickle bunch because they are told that they are mathematicians; however, they fancy themselves as artists. The line "It uses a GOTO instead of a more elegant loop" is an excellent example of how removed most people are from hardware. A "while()" is just conditional branches, which are just "GOTO".
The x86 assembly for:
void main()
{
while(1){;;}
}
results in:
_main:
Leh_func_begin1:
pushq %rbp
Ltmp0:
movq %rsp, %rbp
Ltmp1:
LBB1_1:
jmp LBB1_1 //<--jmp is a GOTO
Leh_func_end1:
...which just proves that hardware is "inelegant". I would say that it is very efficient with a single instruction jump, and simplicity is elegant.
No comments:
Post a Comment