Word annotations
Factor handbook ยป Developer tools

Prev:Stack effect tools
Next:Deprecation tracking


The word annotation feature modifies word definitions to add debugging code. You can restore the old definition by calling reset on the word in question.

Printing messages when a word is called or returns:
watch ( word -- )

watch-vars ( word vars -- )


Timing words:
reset-word-timing ( -- )

add-timing ( word -- )

word-timing. ( -- )


All of the above words are implemented using a single combinator which applies a quotation to a word definition to yield a new definition:
annotate ( word quot -- )


Warning
Certain internal words, such as words in the math, sequences and UI vocabularies, cannot be annotated, since the annotated code may end up recursively invoking the word in question. This may crash or hang Factor. It is safest to only define annotations on your own words.