Tuesday, April 10, 2007

New developer tools

Two new features, both snarfed from Symbolics Lisp Machines.

First of all, Factor now remembers word usage information for top-level forms. Consider a word like define-command-map, which (surprisingly) defines an UI command map. It is only ever called from one word, however a ton of source files call it at the top level to define command maps for various gadgets. The usage. now gives us the full picture, instead of one that misleads the developer into thinking this word is rarely used:
\ define-command-map usage.
IN: operations : define-operation-map ( class group blurb object hook translator -- )
P" resource:core/ui/debugger.factor"
P" resource:core/ui/gadgets/editable-slots.factor"
P" resource:core/ui/gadgets/lists.factor"
P" resource:core/ui/text/commands.factor"
P" resource:core/ui/tools/browser.factor"
P" resource:core/ui/tools/help.factor"
P" resource:core/ui/tools/inspector.factor"
P" resource:core/ui/tools/interactor.factor"
P" resource:core/ui/tools/search.factor"
P" resource:core/ui/tools/tiles.factor"
P" resource:core/ui/tools/traceback.factor"
P" resource:core/ui/tools/walker.factor"
P" resource:core/ui/tools/workspace.factor"

The second new tool is the fix word. Suppose you just changed the number, order or types of arguments of a word. Or you renamed a word. You now have to go through each caller of that word and fix it. The fix word helps with that. It opens each usage of a word in your editor, then prompts while you to make any required changes, then goes on to the next usage. Here is an example:
( scratchpad ) \ reverse fix
Fixing usages of reverse...

Editing definition of $command
RETURN moves on to the next usage, C+d stops.

Editing definition of (compute-free-vregs)
RETURN moves on to the next usage, C+d stops.

Editing definition of (flip-branches)
RETURN moves on to the next usage, C+d stops.

Pretty nifty stuff!

I have some in-progress cross-referencing tools I still haven't merged in, for looking at usage relationships between vocabularies. These will become more useful when the new module system is introduced in 0.90, and I will add them to the core. At that point, I want to cook up an UI cross-referencing tool which presents a unified interface to all the little bits and pieces I've been cooking up.

In completely unrelated news, the darcs repository hasn't worked on ARM for a little while. Shortly after the release of 0.88, I made some changes to the register allocator which in turn introduced some bugs which only manifested on the specific register configuration found on the ARM architecture. This is now fixed; Factor now bootstraps and runs on Linux/ARM again. A Windows CE port is still pending.

No comments: