retroforth/doc/NamingConventions.md
crc 01c40d9d3d shorter lines in docs
FossilOrigin-Name: a3102b7f4f5bd64f79d0ead274320061feb044e888718ffe45464a52ee4cf612
2017-10-22 18:39:45 +00:00

1.1 KiB

Naming Conventions

I use the following general conventions when naming words in RETRO.

All

  • Word names must not start with a prefix character
  • Keep names short, but descriptive
  • Spelling out is preferred over symbols

Variables

These use TitleCase.

Base
Compiler
Dictionary

Constants

These are UPPERCASE, with a dash separating compound names.

MAX-STRINGS
NORTH

Words

Most named items are words. As such, most of the conventions are under this category.

Word names are lowercase, with a dash between compound names.

drop
drop-pair

Use a namespace prefix to group related words. This is a short string, separated from the rest of the name by a colon. See Namespaces.md for a list of the major namespaces in RETRO.

d:for-each
s:to-upper
s:length
c:vowel?
n:negate

Words returning a flag should end in ?

n:even?
n:positive?
c:vowel?

The use of a leading dash implies not:

if
-if
c:vowel?
c:-vowel?

When introducing words, consider including a not form if it makes sense.