next up previous contents
Next: Conclusions Up: Metaclasses Previous: Instantiation of Classes

Support of Metaprogramming

 

The metaclasses constitute the natural place of methods that reflect some knowledge of the classes. The knowledge that I have in mind is, for instance, the list of methods, the list of instance variables, and the list of class variables.

Given a class, say A from the previous section, it should be possible to say

(send A 'method-list)

for hereby to get a list of methods of A (or perhaps of A

and all its superclasses).

It is difficult to obtain a reasonable support of this kind of functionality in Scheme. It would, of course, be possible to keep track of the constituents of the class in a manual way, but this is hardly attractive. If a procedure has access to its own syntactic structure (the lambda expression on list form) it is easy to extract the desired information. In Scheme it is not possible to get access to this kind of ``meta knowledge'' of procedures.

Finally, if classes and methods syntactically are defined via a macro interface, it would be possible to generate the metaprogramming interface, because the macros have access to the necessary syntactic constituents.



Kurt Noermark
Wed Mar 6 10:30:05 MET 1996