|Jump tables and OOP in Oberon email@example.com (1996-07-13)|
|Re: Jump tables and OOP in Oberon firstname.lastname@example.org (Tim Dwyer) (1996-07-18)|
|Re: Jump tables and OOP in Oberon email@example.com (1996-07-22)|
|Re: Jump tables and OOP in Oberon firstname.lastname@example.org (1996-07-23)|
|Re: Jump tables and OOP in Oberon email@example.com (Darius Blasband) (1996-07-23)|
|From:||Darius Blasband <firstname.lastname@example.org>|
|Date:||23 Jul 1996 23:36:08 -0400|
|Organization:||Phidani Software, Brussels|
Ram Meenakshisundaram wrote:
> Also, Oberon has an IS statement that returns TRUE or FALSE if a variable
> is inheriated from a particular type. That is if variable x is of type C and
> type C is inherited by type A, then the following would return true:
> IS(x, A)
> How can this be implemented the most efficent way?
Tim Dwyer wrote:
> There was an article in ACM TOPLAS that gave a way to test whether the
> type of a variable is an extension of another type, without using a loop.
> It uses a little more storage than the method you describe.
Another way of achieveing this is to number your class inheritance tree in a
depth first fashion, in such a way that an interval can be defined for every
class. This interval defines signatures that are known to denote the class.
Any meta class with a signature within this interval is or is derived from
Given an instance, just follow the link to its metaclass, and check whether
its magic number lies within the interval of the class A.
This system is simple, requires constant time when testing, but does not
support convenient dynamic addition of new classes, since the numbering is
performed at system initialization time; while the scheme described in
TOPLAS did support dynamic addition of new classes.
In practice, this has seldom been a problem: renumbering the inheritance
tree is neglectible when compared to the actual addition of a new class to
Return to the
Search the comp.compilers archives again.