FORGE: A File-Oriented Reflective Graphical Environment
What is FORGE?
FORGE is a language-independent, OS-independent, and GUI-independent windowing API provided as a virtual filesystem.
Instead of defining a programming interface as a set of functions, the FORGE API is a set of filing operations. FORGE is inherently object-oriented — however, the objects are all files and the methods are POSIX filing calls.
For example, a window’s title is mapped to a file named "title", whose contents are the window’s title string. Writing the file sets a new title, which is visible immediately in the GUI.
Watch the screencast.
Why?
By keeping GUI resources behind a user/kernel boundary, an application is not limited to running in a single process — it can exist as a collection of cooperating programs — or for that matter, a shell script. It can be written line by line interactively by the user with immediate feedback. Running applications can be queried and manipulated by navigating their directory structure.
Therefore, FORGE (a) provides rapid application prototyping and development, (b) makes the development of 'real' applications accessible to users competent at scripting but not programming, and (c) allows for unprecedented modularity in application structure.
How is it used?
Here’s Hello World in FORGE:
cd $FORGE/gui/port/hello # select a window port named "hello"
exec 9> lock # exclusively retain the port for our use
ln new/caption view # add a caption as the window’s view
echo Hello world > v/text # set the caption text
touch window # create the window
That creates a centered, minimally sized, untitled window with the text "Hello world" at the upper left.
That’s it?
Well, the text doesn’t look right flush against the window border, so let’s modify the previous example:
rm view # remove the caption from the window
ln new/frame view # add a frame instead
ln new/caption v/view # add a caption as the frame’s subview
echo Hello world > v/v/text # set the caption text again
echo 4 > v/padding # set the frame’s padding
That removes the caption, recreates it inside a frame, and sets the frame’s padding to 4 pixels.
FORGE is especially designed to be usable from a Unix shell. A scripting-level user can build a native look-and-feel application as a shell script. More advanced users will still find shell scripting convenient for prototyping Fornaxis programs before rewriting in another language. In addition, an interactive shell can be used to compose a program one line at a time, or to examine or alter a running program’s view structure.
What implementations exist?
A prototype of FORGE is implemented in MacRelix; a port to FUSE is in progress.