From 45c9e90f3956ae5b8e561be046153bcb6ffc0985 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Thu, 24 Mar 2016 20:50:23 +1000 Subject: oo: constructor, unknown and bug fixes - Added support for constructor, runs on new object creation - Added support for "unknown" method - Rename some dispatch variables (add double underscore) to avoid collision with user variables Signed-off-by: Steve Bennett --- README.oo | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'README.oo') diff --git a/README.oo b/README.oo index 57a1af1..8dd7a30 100644 --- a/README.oo +++ b/README.oo @@ -100,6 +100,18 @@ on a specific object. the instance variables, and evaluate the body in that context. This can be used for one-off evaluation to avoid declaring a method. +RESERVED METHODS +---------------- +The following methods are special + + constructor:: + If this method exists, it is invoked (with no arguments) after an object is created + + unknown methodname ...:: + If an undefined method is invoked, and this method exists, it is called with the methodname + and the original arguments + + CREATING OBJECTS ---------------- An object is created with the 'new' method, or simply by using the classname shortcut. @@ -120,6 +132,8 @@ For example: . $b get balance 1000 +If the 'constructor' method exists, it is invoked just after the object is created + DECLARING METHODS ----------------- In addition to the predefined methods, new methods may be declared, or existing -- cgit v1.1