Greets,
In one of the patches uploaded to
<https://issues.apache.org/jira/browse/LUCY-231>, Nick has marshalled a bunch
of metadata relating to Clownfish methods into a single struct. However, not
everything was satisfactory:
> I only don't like the name "method data". Maybe someone has a better idea.
I suggest that we turn these into first class Clownfish objects of the class
"Clownfish::Method", with an eye towards eventually providing a public
introspection API.
The primary purpose of this introspection API would be to codify Clownfish's
limited support for metaprogramming: new classes can be created on the fly at
runtime, but existing classes are immutable and cannot be monkey patched.
The "method data" structs would thus be named "cfish_Method" -- but instead of
defining them statically, we ought to init them from heap memory using
constructor calls, along with our VTables. Some bootstrapping gymnastics may
be necessary in the core parcel, but the general idea is that there should be
a single mechanism for adding new classes which is used both at boot time and
when creating dynamic subclasses on the fly.
We already have metaclass objects: Lucy::Object::VTable.
http://en.wikipedia.org/wiki/Metaclass
In object-oriented programming, a metaclass is a class whose instances are
classes.
For the record, the name "VTable" is a historical artifact -- it describes a
past implementation rather than the current API, as VTables are now
full-fledged objects with state and behaviors rather than just arrays of
method pointers. When VTable moves under the "Clownfish" namespace it should
be renamed to either "Clownfish::Class" or "Clownfish::MetaClass" (as Logan
and I were discussing on IRC a few days ago).
If we go with "Clownfish::MetaClass", then another possible class name for the
method metadata objects is "MetaMethod". That's what Groovy uses, and then
there's "Moose::Meta::Method" on CPAN:
http://groovy.codehaus.org/api/groovy/lang/MetaMethod.html
http://search.cpan.org/perldoc?Moose::Meta::Method
The bare term "Method", though, is what Ruby and Java use:
http://www.ruby-doc.org/core-1.9.3/Method.html
http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Method.html
Marvin Humphrey