class Window
public:
proc init(...)
begin
...
end
proc draw()
..
..
end
// same
syntax as shell classes
shell class Border(Window)
public:
proc init()
begin
end
proc draw()
begin
self.drawBorder();
super.draw();
end
private:
proc drawBorder()
...
end
The previous code defines a dynamic extension class Border (or just extension Border) that is attached to a class Window by command
Meta.attachExtension(Window, Border)
The syntax for dynamic extension classes is the same for shell classes.
An extension is removed by
Meta.removeExtension(Window)
A complete example of the use of extensions is below.
var w1, w2 : Window;
w1 = Window.new(...);
w2 = Window.new(...);
// draw windows without
borders
w1.draw();
w2.draw();
Meta.attachExtension( Window, Border );
// draw windows
with borders
w1.draw();
w2.draw();
var catch : CatchMetaException;
catch#init();
try(catch)
Meta.removeExtension(Window);
// draw
windows without borders
w1.draw();
w2.draw();
end