oop.txt Basic Python-like OOP support
==============================================================================
==============================================================================
This plugin provides some basic OOP support with OOP model similar to Python.
Plugin requires vimpluginloader and its dependencies.
==============================================================================
This plugin provides three functions. Functions are accessed via dictionary
------------------------------------------------------------------------------
All following functions are accessed via dictionary returned by
registerclass({name}[, {functions}[, {variables}[, {parents}]]])
Register a new class with given {name}, list of {functions} and list
of {variables} which will inherit from {parents}. Here {functions}
argument is a dictionary; all non-funcref arguments are filtered out.
List of {variables} is also a dictionary, but nothing is filtered out.
{parents} must be a list of class names, all classes should be defined
before defining {name} class. This function returns a function
reference which is the only way to delete a class with given name.
Note that registerclass function will not redefine existing class.
Get the instance of a class {name}. All subsequenc arguments will be
------------------------------------------------------------------------------
Basic class for custom exceptions. Functions:
Generates error message using __str__ method and echoes it with
hl-ErrorMsg higlighting. Returns echoed error message. Note that
this warning will not be caught by :try ... :catch blocks.
Returns basic error message. Should be redefined in child classes.
==============================================================================
When you request new class instance the following steps are performed.
1. New dictionary with keys __class__ and __variables__ is generated.
2. Generated dictionary is extended with parent classes variables (if any).
3. Generated dictionary is extended with its class variables (but before the
dictionary with varibles is generated by deepcopy(): one copy for every
instance).
4. Generated dictionary is extended with its class functions. Note that
functions from parent classes are inherited when class is registered.
5. Constructor is called with generated dictionary as a self dictionary.
6. Generated dictionary is returned.
All class members may have following special methods/variables:
Defined for all instances, contains class name.
Defined for all instances, contains class variables. Unlike instance
variables, redefining variables in this dictionary will lead to
changing class variables default values (but not the values of already
existing class instances). Changing instance variables will affect
neither existing nor new class instances.
If defined, this method will be called whenever new instances are
generated. {super} argument is a dictionary with either a parent
class methods (if there is only one parent) or with {{name}:
{methods}} pairs. Other arguments are passed from
vim: ft=help:tw=78