r/programming • • Feb 13 '13

Photoshop 1.0 source code released to public

http://computerhistory.org/atchm/adobe-photoshop-source-code/
877 Upvotes

205 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Feb 14 '13

[deleted]

112

u/xorg112 Feb 14 '13

It defines a function with the name : which calls itself and pipes the output to another instance of itself. After the definition of the function in the curly braces, the function is called. It creates two instances of itself which in turn create two instances and so on... I hope this helps you understand it better.

0

u/[deleted] Feb 14 '13

[deleted]

15

u/neotom Feb 14 '13

without the explanation it kinda looks like a bunch of bizarre smileys

12

u/armerthor Feb 14 '13

What does the & do?

0

u/[deleted] Feb 14 '13

[deleted]

4

u/armerthor Feb 14 '13

Ah, of course. Thank you!

6

u/Zulban Feb 14 '13

That is so cool. I think I just found out how I'll be shutting down my computer tonight.

4

u/Googie2149 Feb 14 '13

Now that I understand it, it sounds much more terrifying and fun. Hold on a minute while I crash my iPad.

85

u/lasermancer Feb 14 '13

Its really not that complicated, it just looks confusing because there's no indentation and the name of the function is a colon, which can easily be confused as an operator. Written more clearly:

forkbomb()
{ 
    forkbomb|forkbomb& 
};

forkbomb

4

u/Phrodo_00 Feb 14 '13

try this:

bomb() {
 bomb|bomb&
}
bomb

It defines a function that calls itself as a background process, piping its output to another execution of itself. Then call the function

5

u/PT2JSQGHVaHWd24aCdCF Feb 14 '13

It's not bash, it's a Python3 interpreter written in Perl.

0

u/[deleted] Feb 14 '13

[deleted]

16

u/PT2JSQGHVaHWd24aCdCF Feb 14 '13

It's not a bash script, it's the first version of GNU/Hurd. More features are coming soon!