[comp.lang.forth] Forth style

Mitch.Bradley@ENG.SUN.COM (05/17/91)

> However, in my opinion, [ lower case ] people and languages are
> throwing away half the alphabet.

People are conditioned to interpret "hello" and "Hello" as the same word.
In natural languages, capitalization is generally used to give clues about
sentence structure (i.e. the beginning of a sentence or proper nouns in
English, all nouns in German).  There are cases where the capitalization
or absence of capitalization of a word changes the meaning of the sentence,
but those cases are rare.  More often, people simply make mistakes and
use incorrect capitalization in violation of the (rather complicated and
somewhat arbitrary) rules.

For example, according to the rules, "FORTH" is incorrect.  All caps
signifies an acronym (a "word" composed of the first letters of the
words in a phrase).  (Aside: Most acronyms are silly, and I wish they
would go away.  Unfortunately, many people seem to have an irresistable
urge to name products with acronyms; the phrase the acronyn stands for
isu usually rather contrived, and is generally forgotten in short order.)

Since the letters f-o-r-t-h do not stand for five other words, the
name of the language should be spelled "Forth".  Few people care about
this distinction, and when we communicate, we interpret "Forth" and
"FORTH" and "forth" to mean the same thing.

Although some of my Forth systems are case-sensitive, my current thinking
is that case sensitivity is a bad idea, because it confuses people.

The only operating system I know that that does the "right thing" is OS-9.
OS-9 allows you to create files with mixed case names.  The capitalization
may be used to give "clues" about the file (all caps is typically used
for directory names).  However, the file name searching mechanism is
case-insensitive.  OS-9 does not allow you to create different files
whose names differ only in the case of the letters.

I am certain of one thing: A programmer who creates 2 different names
that differ only in capitalization is asking for trouble, even if the
system is case sensitive.

Mitch.Bradley@Eng.Sun.COM

Mitch.Bradley@ENG.SUN.COM (05/17/91)

> The names should be choosen carefully so that the resulting modules "say"
> what they do.  Some of this comes from internal naming conventions
> (i.e. "/" means initialize, ">" means pointer to..., etc.), but most
> comes from imaginitive vocabularies (i.e. a thesaurus).

I believe that imaginative names contribute to the "poetic beauty" of
Forth code, but often make it the code harder to understand.  For
instance, consider the word "JOT".  JOT is the name of the number
conversion buffer in Zen Forth.

When I first saw some code with that word in it, I though "that's an
amusing word; I wonder what the @#$% it does?".  If the word had instead
been NUMBER-BUF, I would have known exactly what it does, and I wouldn't
have had to spend time looking it up.  NUMBER-BUF has no poetic beauty,
but any idiot immediately knows exactly what it does.

Words which are used a lot should have terse names.  Words which are
used infrequently should have very-descriptive names.

"Cuteness" contributes to Forth's reputation as a difficult-to-read
language.

The problem with short English words is that they tend to have several
meanings, none of which is entirely descriptive of any particular
programming language function.

Names should indeed be very carefully chosen, but in most cases,
precision and clarity is more important than "prettiness".

Mitch.Bradley@Eng.Sun.COM

nick@sw.stratus.com (Nicolas Tamburri) (05/20/91)

In Article 4829 Mitch.Bradley@ENG.SUN.COM writes:
> [Lots of capitalization background deleted...]
> [Conclusion:]
> I am certain of one thing: A programmer who creates 2 different names
> that differ only in capitalization is asking for trouble, even if the
> system is case sensitive.

Excuse me for stating the obvious here, (maybe that's why you didn't
state it Mitch.) I would think that the overwhelming reason to not play
games with case sensitive names is that it makes for very unportable
code. Some systems honor case sensitivity, others don't and I've seen
one that lets you type a defining name in any case, but stores it in
the definition header in upper case only.

I don't know about anybody else in this group,  but I care a great deal
about portability.  :-)

							/nt

nick@kyron.sw.stratus.com