Module clopwh.core

Core module of CLOPWH.
Author : combacsa (combacsa@gmail.com, aka Byun, Kyuhong aka Francisco)

Functions

binary_operator_generator (class_id, operator) Create binary operator overloading function for given class and operator.
class_names_to_class_ids (class_names) Convert array of Class into array of class_id.
constructor (class_id, ...) Return a new Object for given class with calling its constructor with given parameters.
get_type (object) Returns the type (Class) of given object.
is_a (object, class_name) Returns whether given object belongs to the given class or not.
linearize (class_id, direct_parents) Linearize multiple inheritance information.
lookup (class_id, key) Return a function that matches with key for given class_id and its ancestors.
lookup_generator (class_id) Create new lookup function for given class.
register_class (declaration, class_function, inherits) Register new class into class_array and create new Class according to the declaration.
register_default_classes () Register default Classes.
unary_operator_generator (class_id, operator) Create unary operator overloading function for given class and operator.


Functions

binary_operator_generator (class_id, operator)
Create binary operator overloading function for given class and operator.

Parameters

  • class_id: Class id
  • operator: operator to be overloaded

Return value:

lookup function for the class with given operator
class_names_to_class_ids (class_names)
Convert array of Class into array of class_id.

Parameters

  • class_names: table(array)of class names

Return value:

table(array)of class ids
constructor (class_id, ...)
Return a new Object for given class with calling its constructor with given parameters. If there is no constructor, seek to its ancestors.

Parameters

  • class_id: Unique id for given class
  • ...: Parameters passed to the class constructor

Return value:

Object created by that constructor
get_type (object)
Returns the type (Class) of given object.

Parameters

  • object: Object to know the class

Return value:

Class for the object
is_a (object, class_name)
Returns whether given object belongs to the given class or not.

Parameters

  • object: Object to test whether it belongs to given Class
  • class_name: Class (function) to test whether given object belongs to it

Return value:

whether given objec is of given class (according to inheritance)
linearize (class_id, direct_parents)
Linearize multiple inheritance information.

Parameters

  • class_id: Class' unique id
  • direct_parents: Class' direct parents

Return value:

linearized class inheritance
lookup (class_id, key)
Return a function that matches with key for given class_id and its ancestors.

Parameters

  • class_id: Unique id for class.
  • key: Given function name to lookup.

Return value:

The function matching with key. If nothing exist, nil.
lookup_generator (class_id)
Create new lookup function for given class.

Parameters

  • class_id: Unique id for given class

Return value:

Lookup function which corresponds only with the given class
register_class (declaration, class_function, inherits)
Register new class into class_array and create new Class according to the declaration.

Parameters

  • declaration: table which contains Class declaration
  • class_function: (optional) constructor function for given class
  • inherits: (optional) inheritance for given class

Return value:

Constructor function which is capable of creating object for given class
register_default_classes ()
Register default Classes.
unary_operator_generator (class_id, operator)
Create unary operator overloading function for given class and operator.

Parameters

  • class_id: Class id
  • operator: operator to be overloaded

Return value:

lookup function for the class with given operator

Valid XHTML 1.0!