16 7910
Japcuh wrote: How do you write self modifying code in Java?
What do you mean by "modify?" A Java program can
extend itself by loading new classes on the fly, if
that suits your needs.
-- Er*********@sun.com ja****@gmail.com (Japcuh) wrote in news:3a8cbb2e.0407021131.55805361
@posting.google.com: How do you write self modifying code in Java?
You may want to check out the Java code generation library cglib: http://cglib.sourceforge.net/
Best Regards
Kristian Larsen
On Sat, 03 Jul 2004 15:49:21 GMT, kjc <ks*****@elp.rr.com> wrote or
quoted : No, but this could be done in Smalltalk blind folded.
Japcuh wrote: How do you write self modifying code in Java?
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. an************@gmail.com (Andrew Chambers) wrote in message news:<f3************************@posting.google.co m>... ja****@gmail.com (Japcuh) wrote in news:3a8cbb2e.0407021131.55805361 @posting.google.com:
How do you write self modifying code in Java?
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.
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 <ks*****@elp.rr.com> wrote in message news:<5A*****************@fe1.texas.rr.com>... No, but this could be done in Smalltalk blind folded.
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
Japcuh wrote: 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 ja****@gmail.com (Japcuh) wrote in message news:<3a**************************@posting.google. com>... 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
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" <ja****@gmail.com> wrote in message
news:3a**************************@posting.google.c om... 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
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.
l8r, Mike N. Christoff ja****@gmail.com wrote... How do you write self modifying code in Java?
If it's truly self-modifying, good luck debugging it.
Entropy <en*****@domain.invalid> scribbled on the stall wall: ja****@gmail.com wrote... How do you write self modifying code in Java?
If it's truly self-modifying, good luck debugging it.
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 =---- no***@uber.usachoice.net wrote... Entropy <en*****@domain.invalid> scribbled on the stall wall: ja****@gmail.com wrote... How do you write self modifying code in Java?
If it's truly self-modifying, good luck debugging it.
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.
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.
Wiseguy wrote: Entropy <en*****@domain.invalid> scribbled on the stall wall:
ja****@gmail.com wrote...
How do you write self modifying code in Java?
If it's truly self-modifying, good luck debugging it.
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.
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.ClassLoader.
-- Er*********@sun.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: qwweeeit |
last post by:
Hi all,
when I was young I programmed in an interpreted language that allowed
to modify itself.
Also Python can (writing and running a module, in-line):
fNew =open("newModule.py",'w')
lNew=...
|
by: Joel Jose |
last post by:
agreed the 'mutation engine' by dark avenger was a real deadly
master-code piece..,
but then.. if one could create a self mutating code..in real
time then i think it would just b the most...
|
by: Ralf W. Grosse-Kunstleve |
last post by:
My initial proposal
(http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html) didn't
exactly get a warm welcome...
And Now for Something Completely Different:
class autoinit(object):...
|
by: Robin Becker |
last post by:
When young I was warned repeatedly by more knowledgeable folk that self
modifying code was dangerous.
Is the following idiom dangerous or unpythonic?
def func(a):
global func, data
data =...
|
by: AES |
last post by:
Can an HTML web page dynamically modify its own code?
(without resort to Java or any other non-HTML complexities)
That is, is there any provision in HTML such that a single
"Next" button on a...
|
by: jon |
last post by:
I am a beginner C programmer, this is actually my first programming
lanugage, besides html, cgi, and javascript. I am looking for a way to
make an .exe file, or a copy of my own file. I have tried...
|
by: IUnknown |
last post by:
Ok, we are all aware of the situation where modifying the folder
structure (adding files, folders, deleting files, etc) will result in
ASP.NET triggering a recompilation/restart of the application....
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
header("Location:".$urlback);
Is this the right layout the...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
| |