Sunday, 15 August 2010

java - Can a source code manipulate other or itself while running? -



java - Can a source code manipulate other or itself while running? -

for example, 2 source codes written in way both of them homecoming number , print out random string(for example:"i have died number times") number times. of import point in here number returned 1 programme number added other program's string. 1 thing should considered both programs hypothetically intervene others source code , runs forever. means homecoming value of 1 programme main factor manipulate other program.

question: doable,(for illustration in java) if can programme alter own source code?

yes, it's do-able in theory. self-modifying code entire branch of computer science.

it's thought in real world though, , if going it, java (or other compiled languages) not best choice. javascript, php¸ python (e.g. what python's eval() do? ), ruby, groovy etc offer ways run arbitrary code, generate other arbitrary code... it's nightmarish debug, secure, test , prove it's doing right thing.

it's improve design programme carefully, , poster said, work info structures, not native source code.

java file-io

No comments:

Post a Comment