Opened 14 years ago

Closed 12 years ago

#126 closed task (fixed)

Provide mechanism for user to extend Java classes via Lisp

Reported by: Mark Evenson Owned by: nobody
Priority: minor Milestone: 1.2.0
Component: java Version: 1.0
Keywords: Cc:
Parent Tickets:

Description

In a question on StackOverflow a user asks if it is possible to extend a Java class in Lisp. This sort of functionality generally seems to be unavailable in any JVM language, only possible by using bytecode libraries. Since we have a fairly complete bytecode library in our Java class writer, it might provide a distinguishing feature to implement such an extension mechanism.

Change History (2)

comment:1 Changed 14 years ago by Mark Evenson

I envision this as resulting in a Java class that has specialized constructors/static initializers that somehow "connect" a given Lisp implementation (hashtable of constructors, variables, and methods?) to a running instance of Interpreter.

Some questions towards an implementation:

  1. Syntactically how would one specify access to member variables in the superclass?
  1. The Lisp implementation would probably have to be marked as final, as enabling the extension of the Lisp version again in Java would be too tough?
  1. Would one have to run static initializers in the super class(es)?

The more I think about it, this would be a non-trivial amount of work, as it basically means re-inventing much of the mechanisms of Java (the language) in Lisp.

comment:2 Changed 12 years ago by Evenson Not Org

Milestone: unscheduled1.2.0
Resolution: fixed
Status: newclosed

Resolved with the (incomplete) implementation of JAVA:JNEW-RUNTIME-CLASS.

Patches for further improvement are solicited.

Note: See TracTickets for help on using tickets.