Qore reflection Module  0.9.4
Qore reflection Module

reflection Module Introduction

The reflection module allows for Qore code to search and list the definitions and declarations in a Qore Program object.

This module is released under the MIT license (see COPYING.MIT in the source distribution for more information). The module is tagged as such in the module's header (meaning it can be loaded unconditionally regardless of how the Qore library was initialized).

To use the module in a Qore script, use the %requires directive as follows:

%requires reflection

To prohibit reflection in a Program object; use the PO_NO_REFLECTION sandbox restriction when creating the object or when setting sandboxing restrictions on the Program object.

Classes provided by this module:


Typed hashes:

Objects created from reflection classes provided by this module are wrappers over the actual C++ objects; for this reason comparing different objects with the == or != operators will not return the expected results. To perform comparisons on reflection objects, use the isEqual() methods such as AbstractClass::isEqual(), AbstractMember::isEqual(), or Namespace::isEqual(), among others.


#!/usr/bin/env qore
%requires reflection
Class c = Class::forName("Condition");
AbstractMethodVariant v = c.getVariant("wait", Class::forName("AbstractSmartLock").getType(), TimeoutType);
printf("%s\n", v.toString());
# produces the following output:
# public int Condition::wait(object<AbstractSmartLock> lock, timeout timeout_ms = 0)

reflection Module Release Notes

reflection Module Version 0.9

  • initial public release