Some strategies for dealing with scaffolding

Up to Season 1: Factor

Some strategies for dealing with scaffolding

Posted by Michael T. Richter at March 31. 2013

The default assumption of a Factor install is that you'll be doing all your work in the ./work tree under the installation point.  This is not an assumption I'm personally comfortable with (and it's one that will flatly break if you install Factor anywhere outside of $HOME!).


The recommended approach to working outside the Factor installation tree is to add any subdirectories you'll be working through in the file $HOME/.factor-roots, one line per directory.  For example my .factor-roots file looks like this:


This allow me now to type things like "/home/michael/Development/Factor/projects" "my-project" scaffold-vocab when I want to open a new project and to have that directory searched when I start USE:/USING: vocabularies.


That being said, it's a bit verbose and error-prone that way.  So instead here's my $HOME/.factor-rc file:

USING: editors.textadept kernel namespaces helpers ;

This loads a bunch of things that I plan on using every time.  The last item, helpers, is the interesting one.  In /home/michael/Development/Factor/projects/helpers/helpers.factor I have the following code:

USING: kernel namespaces tools.scaffold ;

IN: helpers

! Build scaffolding somewhere other than the Factor source tree.
: new-project ( vocab -- )
    [ "/home/michael/Development/Factor/projects" ] dip

This permits me to type "my-project-name" new-project in the listener instead of the long and error-prone command given before.


There's one minor point of annoyance: you'll have to either type USE: helpers in the listener when you start or you'll have to use the auto-loader (and its annoying message) the first time you use anything in the helpers package.  I haven't found a way around that one yet.


Note that any helper words you'd like can be defined in this file.

Re: Some strategies for dealing with scaffolding

Posted by Gert Meulyzer at March 31. 2013

Another way is to do everything in your .factor-rc file.

This is how mine looks:

USING: namespaces editors.emacs vocabs.loader ;
"/usr/bin/emacsclient" \ emacsclient-path set-global
"/home/gert/src/experiments/factor/" add-vocab-root

Re: Some strategies for dealing with scaffolding

Posted by Michael T. Richter at April 01. 2013

Adding the vocab root there works, yes, but doesn't give you the ability to build scaffolding there without typing in the tedious "/home/gert/src/experiments/factor/" stuff.

Powered by Ploneboard
My Latest Tweets
There was a problem retrieving the twitter updates.