Definition Dependency Management


This vocab manages dependency data during stack checking of words. All dependencies are divided into three types representing how words can depend on other words:
+definition+

+effect+

+conditional+


The type of the dependency determines when a word that depends on another word that is recompiled itself has to be recompiled. For example if word a has a +definition+ dependency on word b, and b's definition is changed, then a must be recompiled. Another dependency type is +effect+ which means that word depends on the stack effect of another word. It is a weaker form of dependency than +definition+. A words definition can change without its stack effect changing, but it it's stack effect is changing it implies that its definition is also changed.

The third dependency type, +conditional+ encodes a conditional dependency between a word and other word which is usually a class. A condition object, kept in the word property "dependency-checks" evaluates if the condition is satisfied or not. If it isn't satisfied, then the word is recompiled. The types of condition objects are:
depends-on-class-predicate

depends-on-final

depends-on-flushable

depends-on-instance-predicate

depends-on-method

depends-on-next-method

depends-on-tuple-layout


The main benefit of using these condition checks is to ensure that if a word is changed, it doesn't cause 'cascading' recompilations.

During stack checking, state to build dependency data is kept in the following variables:
conditional-dependencies

dependencies

generic-dependencies


Words for adding various types of dependencies:
add-depends-on-c-type ( c-type -- )

add-depends-on-class ( classoid -- )

add-depends-on-class-predicate ( class1 class2 result -- )

add-depends-on-final ( word -- )

add-depends-on-flushable ( word -- )

add-depends-on-generic ( class generic -- )

add-depends-on-instance-predicate ( object class result -- )

add-depends-on-method ( class generic method -- )

add-depends-on-next-method ( class generic next-method -- )

add-depends-on-tuple-layout ( class layout -- )