Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Self Modifying Code

Name: Anonymous 2008-01-18 5:43

A technique so advanced and powerful that only the very best of the best EXPERT PROGRAMMERS can understand and only partially exploit its power. It is so powerful, infinitely more so than goto, that Dijkstra would turn over in his grave at the very mention of it. To use an old analogy, self-modifying code not only makes it easy for you to shoot yourself in the foot, but also end the universe along with it. It is in the realm of the programming gods, for with it one may even be able to write programs that achieve sentience.

Discuss.

Name: Anonymous 2008-01-18 6:43

NO EXCEPTIONS

Name: Anonymous 2008-01-18 6:46

Satori > sentience

Read SICP

Name: Anonymous 2008-01-18 7:20

You mean first-class environments?

Name: !7vtTERhreY 2008-01-18 12:41

>>3
Satori == sentience

Name: Anonymous 2008-01-18 13:38

Self-modifying code was commonplace with the 6502. It was generally cheaper to store a memory address in the immediate indexed mode instruction (e.g. lda $ffd4,x) that used it rather than on the zero page and using zero page indirect with index addressing (e.g. lda ($cc),x). Saved at least one cycle, there... though if you wanted to use the same address with multiple instructions going through the zero page was generally more winlike.

Name: Anonymous 2008-01-18 13:39

>>6
I totally didn't understand a word of that, and I feel better for it.

Name: !MhMRSATORI 2008-01-18 13:57

>>7
You have not even achieved Satori yet. Read SICP.

Name: Anonymous 2008-01-18 14:07

"Self Modifying Code" is trivial...

Name: Anonymous 2008-01-18 15:27

>>9
Especially in Python. Any useful object modifies self.

Name: Anonymous 2008-01-18 15:43

>>10
Get out.

Name: Anonymous 2008-01-18 19:23

That's why I write all my code in interpreted XML.

Name: Anonymous 2008-01-18 20:48

>>12
Which one? XSLT?

Name: Anonymous 2008-01-19 0:03

>>12
Which one? XPath? J2EE? MSSQL?

Name: Anonymous 2008-01-19 1:50

Name: Anonymous 2008-01-19 4:04

>>6
1) There is no lda (zp),x instruction, only lda (zp),y and lda (zp,x)
2) lda $ffd4,x is not "immediate indexed", it is absolute indexed.
3) Self-modifying absolute stores are both 1 byte longer and 1 cycle slower per byte modified than zp stores, so the write/read total is a wash vs using a zp variable if you don't read more than write, and you get killed if there are many different readers to update.

Name: Anonymous 2009-03-18 3:24

Don't call me gay, but I need some mary jay!

Marijuana MUST be legalized.

Name: Anonymous 2010-12-21 23:01

Name: Anonymous 2011-02-03 3:25

Name: Anonymous 2011-02-18 13:38

<-- check my doubles

Don't change these.
Name: Email:
Entire Thread Thread List