TOM
 
Fast Example 1: Extensibility
 
 
TOM Home
TOM Tasks

FAQ
News
Highlights
Publications
Documentation
Download TOM
TOM Software
Bug Database
Mailing Lists

Mail:
tiggr at gerbil.org

Short Cuts:
Tesla
TOM/Gtk
GP
MU

Snapshots:
all of 'em
tom [an error occurred while processing this directive]
tesla [an error occurred while processing this directive]
mu [an error occurred while processing this directive]
tomgtk [an error occurred while processing this directive]

Released:
all of 'em
tom 1.1.1
tomgtk 0.11
tesla 0.91
gp 0.5
mu 1.0

Misc:
GIF free NOW!

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
 
Copyright © 1997-2002 Programmers Without Deadlines