Alessio Stalla writes:
Exactly, we agree. The point I was trying to make is that the container class must exist, so the compiler must create it.
Or the compiler could create only the code vector and the class loader could create the class.
Good, so you should be able to write a "classloader" that supports creation of an anonymous subclass of "compiledFunction" (of which there might never be any instances) given a single argument of type byte vector.
Anonymous classes don't exist in the JVM, but apart from that, you
(Does this mean that you have to look for names that don't yet exist and worry that later you're going to be asked to create a class of the same name that you made up?)
have just described the abcl classloader ;) However, my original point
That does not need any temporary files, right?
was not about the general compilation model of abcl, which is more than fine by me; rather, it was about the specific fact that the generated code includes instructions to load the other code it needs (compiled local functions), and I think that is a Bad Idea and we can use classloaders properly to avoid it.
I guess you mean that when you call compile the result could be something like a list of pairs of code vectors and generated names and that a class loader for that list (multiple class loader?) could create classes for all of them and allow them to refer to each other as necessary. If in lisp you do (compile (defun f(x) (g x))) when g is not yet defined, what does f compile into? Can you load a class that refers to another class that does not exist? How does that work if the classes are all immutable?