Introspection Capabilities in Java (RE: Languages and AI)

From: Ben Houston (ben@exocortex.org)
Date: Fri Jul 20 2001 - 17:10:18 MDT


Ben Goertel said:
>In Java, you can't introspect to see the *runtime* state of an individual
>object (the ephemeral values with which local variables are instantiated).
>For this, we'd need a fundamentally different JVM.

You can query and modify values of objects in java at runtime. In fact, we
are doing it in the current project I am working on (this isn't a bluff or
grandstanding, we actually are). We are using the following classes that
are documented in the standard Java implementation:

Java.Lang.Class
http://java.sun.com/j2se/1.3/docs/api/java/lang/Class.html
  - can be used to get a complete list of available Classes.
  - can be used to instantiate new Classes of any type.
  - used to query a Class for available Field and Methods

Java.Lang.Reflect.Method
http://java.sun.com/j2se/1.3/docs/api/java/lang/reflect/Method.html
 - used to get info on a Method and even invoke it.

Java.Lang.Reflect.Field
http://java.sun.com/j2se/1.3/docs/api/java/lang/reflect/Field.html
 - used to get info on a Field, get its value or change it.

Cheers,
-ben houston
http://www.exocortex.org/~ben

-----Original Message-----
From: owner-sl4@sysopmind.com [mailto:owner-sl4@sysopmind.com]On Behalf Of
Ben Goertzel
Sent: Friday, July 20, 2001 6:28 PM
To: sl4@sysopmind.com
Subject: RE: Languages and AI

> But it wouldn't be that hard to write up an XML parser that can
> modify/execute objects, methods or events using introspection -
> introspection is supported pretty well in both C# or Java.

In Java, you can't introspect to see the *runtime* state of an individual
object (the ephemeral values with which local variables are instantiated).
For this, we'd need a fundamentally different JVM.

Maybe this will be supplied in Pizza (which adds higher-order functions to
Java) or some other new-wave Java variant

Ben



This archive was generated by hypermail 2.1.5 : Wed Jul 17 2013 - 04:00:36 MDT