Menu

What's in a name?

thebeez

"I detest the word LOGON. There is no such word in English. I was looking for a word that said: I'm. . . It was a natural. I just stumbled across it. Even though it's clumsy with that apostrophe, it has that sense of rightness. All these little words are the nicest way of getting the AHA! reaction. If you think of the right word, it is obviously the right word. If you have a wide recall vocabulary, you're in a better position to come up with the right word".

  • Charles Moore

No book has been so influential to me - and hence 4tH - as "Thinking Forth". You'll even find traces of it in my C programs.

The quote I started this article with, originated there. And the rules, that are laid out there, are applied when adding words to 4tH. Like TAG, STOW, OFFSET, ARRAY, STRING, USE, EXCEPT, UNLESS, CHOP, DONE, LAST or LATEST. All perfectly English words. And yes, hyphenated words are out. Show me a dictionary entry that says OPEN-FILE. I must admit, sometimes I use a thesaurus to get the perfect word. And sometimes I'm still not happy with a name and change it later on.

In Forth, you can use any character in a name as long as it is not a whitespace character. Now you'd think that you have complete freedom to express yourself in the most extravagant ways. But no. There are rules. And they are listed in that very same book, page 286. E.g. a name enclosed by parenthesis represents an internal word. That's why you frequently find it in library members - and hence such words are removed from the symboltable at the end of the library by a HIDE clause.

But hey, you say. There are enough words in 4tH - non-ANS Forth words - that do not comply by these rules. That's right. Often, I nicked them from other Forths. Like STRUCT (VFX Forth) or ENUM (SwiftForth). I kept the original names because I didn't want to confuse people - or have to come up with alternatives myself, which is even worse.

Finally, there is something like namespace clobbering. Let me explain. There are certain names that are bound to turn up in user programs. Like "ERROR". If I had taken that name, the user would have been confronted with an "is already defined" error if he used that name in one of his programs. That is why I called it (ERROR). Just to avoid that situation. It is the same reason why I hide all internal words in library members. To allow you to better express yourself - and not run into unnecessary compilation errors.

Some library members would - I admit it - benefit from a Object Oriented approach. Still, I want you to be able to use them in an imperative environment as well. These kinds of words usually get a prefix like "DB.", "IDX." or "L.", so we can still use words like "OPEN", "CLOSE", "FIND", etc. for operations. And no, you don't want to use standard Forth namespaces. That gets pretty confusing quite quickly, believe me - and I don't support them anyway.

So the next time you encounter a word with a particular name, remember that name was not given lightly. There is some thought behind all this.