--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
japcuh@gmail.co m (Japcuh) wrote in news:3a8cbb2e.0 407021131.55805 361
@posting.google .com:
[color=blue]
> How do you write self modifying code in Java?[/color]
You may want to check out the Java code generation library cglib:
On Sat, 03 Jul 2004 15:49:21 GMT, kjc <ksitron@elp.rr .com> wrote or
quoted :
[color=blue]
>No, but this could be done in Smalltalk blind folded.
>
>Japcuh wrote:[color=green]
>> How do you write self modifying code in Java?[/color][/color]
Is it a problem that you sometimes do it accidentally?
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
> japcuh@gmail.co m (Japcuh) wrote in news:3a8cbb2e.0 407021131.55805 361[color=blue]
> @posting.google .com:
>[color=green]
> > How do you write self modifying code in Java?[/color]
>[/color]
andyfaeglasgow@ gmail.com (Andrew Chambers) wrote in message news:<f37001.04 07030819.5f2814 3d@posting.goog le.com>...[color=blue][color=green]
> > japcuh@gmail.co m (Japcuh) wrote in news:3a8cbb2e.0 407021131.55805 361
> > @posting.google .com:
> >[color=darkred]
> > > How do you write self modifying code in Java?[/color]
> >[/color]
>
> http://java.sun.com/developer/techni...leases/j2se15/
>
> The metadata bit of this seems to suggest that in future releases of
> java, you'll be able to generate actual source code on the fly.[/color]
I think the metadata is for hints for documentation generation.
I could be wrong.
But I'd hate to work out a security system for Java if they allow the
code to modify itself. Dynamically extending classes is plenty.
kjc <ksitron@elp.rr .com> wrote in message news:<5AAFc.125 77$mY2.621@fe1. texas.rr.com>.. .[color=blue]
> No, but this could be done in Smalltalk blind folded.[/color]
You can use Java Reflection which is Java's counterpart to Smalltalk's
perform: concatenate some strings to create an existing method name
and call that method. Or you can use the command pattern and add
commands as required to a list and execute them sequentially.
Cheers, Oliver
[color=blue]
> Japcuh wrote:[color=green]
> > How do you write self modifying code in Java?
> >
> > Japcuh
> > (Just Another Perl C Unix Hacker)
> > http://www.catb.org/~esr/faq/hacker-howto.htm#what_is
> > .0.
> > ..0
> > 000[/color][/color]
"Japcuh" <japcuh@gmail.c om> wrote in message
news:3a8cbb2e.0 407021131.55805 361@posting.goo gle.com...[color=blue]
> How do you write self modifying code in Java?
>
> Japcuh
> (Just Another Perl C Unix Hacker)
> http://www.catb.org/~esr/faq/hacker-howto.htm#what_is
> .0.
> ..0
> 000[/color]
japcuh@gmail.co m (Japcuh) wrote in message news:<3a8cbb2e. 0407021131.5580 5361@posting.go ogle.com>...[color=blue]
> How do you write self modifying code in Java?
>
> Japcuh
> (Just Another Perl C Unix Hacker)
> http://www.catb.org/~esr/faq/hacker-howto.htm#what_is
> .0.
> ..0
> 000[/color]
It's nowhere near as easy as it is in Perl.
If you look at JDBC you'll see that there's a call to Class.forName()
to load the driver class. That may be of use to you. It's sort of an
'import' on the fly.
"Japcuh" <japcuh@gmail.c om> wrote in message
news:3a8cbb2e.0 407021131.55805 361@posting.goo gle.com...[color=blue]
> How do you write self modifying code in Java?
>
> Japcuh
> (Just Another Perl C Unix Hacker)
> http://www.catb.org/~esr/faq/hacker-howto.htm#what_is
> .0.
> ..0
> 000[/color]
Look up "Javassist" on google. Its what JBoss 4.0 uses to do dynamic aspect
weaving and dynamic remote proxy generation among other things. By the way,
for those who have used cglib, can you point toward some good online docs?
I have been unable to find any I found adequate. Javassist has pretty good
docs however.
Entropy <entropy@domain .invalid> scribbled on the stall wall:[color=blue]
> japcuh@gmail.co m wrote...[color=green]
>> 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.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Comment