Self Modifying Code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • blinky

    #16
    Re: Self Modifying Code

    noone@uber.usac hoice.net wrote...[color=blue]
    > Entropy <entropy@domain .invalid> scribbled on the stall wall:[color=green]
    > > japcuh@gmail.co m wrote...[color=darkred]
    > >> How do you write self modifying code in Java?[/color]
    > >
    > > If it's truly self-modifying, good luck debugging it.[/color]
    >
    > the simple answer is "you can't"...self modifying code hasn't really been
    > feasible since the fortran 4 days...or maybe in C but that is still
    > platform dependent.[/color]

    I recall the capacity of LISP-like functional languages (ie, Scheme)
    to dynamically generate new functions and apply them.

    It was a long time ago when I sat in that class, however, and I've
    never used such a language outside of the classroom.

    Comment

    • Eric Sosman

      #17
      Re: Self Modifying Code



      Wiseguy wrote:[color=blue]
      > Entropy <entropy@domain .invalid> scribbled on the stall wall:
      >[color=green]
      >>japcuh@gmail. com wrote...
      >>[color=darkred]
      >>>How do you write self modifying code in Java?[/color]
      >>
      >>If it's truly self-modifying, good luck debugging it.[/color]
      >
      >
      > the simple answer is "you can't"...self modifying code hasn't really been
      > feasible since the fortran 4 days...or maybe in C but that is still
      > platform dependent.[/color]

      Java "modifies itself" every time it loads a new class
      definition. An important point is that the decision to load
      a class is made at run time, not at a "link time."

      A Java program can even generate an array of bytecodes
      at run time, turn them into a class, and create objects of
      that class; see defineClass() in java.lang.Class Loader.

      --
      Eric.Sosman@sun .com

      Comment

      Working...