A New way to Use BV Forth? -- ForthLib
Posted by admin on March 02 2008 12:04:41
There is a NEW way to use Forth? // Check out ForthLib // What is the most annoying about getting any new code? You start to compile and there are missing functions (words in Forth's case), you have no idea what they do and it takes a long time to find out so that you can get the new stuff working. Something else? Well, often you have to load a 'library' of words just for one or two that you need, working out the dependencies is an impossible task, so you just load the whole lot. And the last gripe for today? To offer functionality for a piece of hardware, the SD Card for example 90% of the words are there to support the main, needed words such as open, write etc. the other words need to be hidden in the background and you certainly don't want them to clash with your code.
Extended News
So enter 'Forthlib'. This new section of this site contains 'standard' libraries that can be used directly from the site. If this is combined with BV Terminal 3 and BV Forth then we can obtain the following advantages and usability:

1) Any new code written can use these libraries, the library is in a fixed location and can be accessed form anywhere. If you are a teacher you can set an assignment using the libraries and know everybody will have the same code. If you want to have any code included, then please email the admin.

2) Not sure of what a library contains? Look it up in the library and it is displayed as a web page. // this is standard code, it is the web site that does the formatting // The web page has links to the words, see what the comments are. This is also useful when working with a library so that words can easily be seen and thus incorporated into your own code.

3) To use the library simply copy and paste the text at the top of the displayed library beginning with // #URL....

4) The libraries can only be usefully used with BV Terminal 3 (BVT). This is because it does a substantial amount of work. If a word has not yet been defined, BV Forth will throw an error, this is picked up by BVT and it will go off an search the libraries that it has loaded. It will abort the current word, supply the new word and carry on where it left of. Of course the new word may also have other words that need other libraries, the process can nest down for up to 50 levels. The outcome of all of this is that a) only those words that are actually required are loaded and b) there is a very good chance of new code compiling properly.

5) Scope ID (SID) was introduced to BV Forth as an alternative to vocabularies. BVT can now use SID and keep private code private so that there is a minimal chance of word clashes.

Try it out with one of the examples on a fresh system, the link to ForthLib is on the top and side menus.