Given a class with a method which can multiply two numbers:
|
implementation class
CueteeLib.ItsClass end;
implementation instance
CueteeLib.ItsClass
int
multiply int a
by int b
{
return 42;
}
end;
|
We observe that this class has a bug: it will only correctly multiply if
the answer is 42.
`But we have the source,' you think, `so we can fix it.'
Wrong: this class is buried deep inside a library and you do not have
the source. Or, in a different scenario, you are not allowed to modify
it or distribute patches.
Problem: You want to use the library. You need to use the
library. If only you could get rid of this bug.
Enter TOM. In your program, you just fix the bug by replacing the
faulty method. You replace the method in an extension of the class that
you include in your program.
|
implementation class
CueTeeLib.ItsClass extension MyProg
end;
implementation instance
CueTeeLib.ItsClass extension MyProg
int
multiply int a
by int b
{
return a * b;
}
end;
|
Problem solved. Without recompilation of the faulty class. Without its
source code. That's extensibility. By TOM.
Up: Highlights
|