Identifier Naming Conventions

Identifiers

Identifiers in the Veeyu programming language are named with lowercase roman alphabets, digits, hypens and trailing question marks and exclamation points. (In fact, all characters in Unicode except some special characters like whitespaces and colons are valid for identifiers.) Words in identifiers are not concatenated with underscores unlike C/C++, but hyphens like Lisp dialects. Camel cases are not used also.

  • a, b
  • apple
  • write-line

Types

Type means objects that inherit from the <type> class in the Veeyu programming language. Generally it refers classes that are instances of <class>, <abstract-class>, <singleton-class> or predicates that mean instances of <predicate>.

All types’ names are be surrounded with angle brackets. (Exactly, these aren’t angle brackets — U+27E8 and U+27E9, but inequality operators — U+003C and U+003E — in the Unicode.) Their names should be a noun or an adjective e.g. <person>, <applicable>.

Functions

Functions and methods should be named as verb e.g. write, fetch-column. It can be composite with adverb also e.g. sort-reversely, play-asynchronously. Predicate functions should be named as the third person singular verb form and trailling question mark e.g. contains?(not contain), has-child?(not have-child?), is-top?, exists?(prefer than is-existing?).

The names should end with a exclamation mark if the function mutates its arguments (in other words: destructive function) or the method affects its receiver e.g. sort!, save!.

Variables And Properties

Variables and properties should be named as a noun e.g. body, child. It can be plural e.g. bodies, children when the value is a container which accepts values of variable numbers like list, map. Adjective words are acceptable only for boolean values e.g. stable, but prefer noun forms e.g. stability.

There are some special properties that have a name starts with plus character (+) like +attributes. This plus character makes names to avoid conflict with user-defined names. (For example, id is too commonly used name, so it is easy to be conflicted with others.) This reserved prefix character is used by only language-defined runtime. Do not use this prefix character.

Global States

Global variables that contains a <mutable-object> should starts and ends with * e.g. *db-connection*.

Operators

There is no operator in the Veeyu programming language. But methods can be called by binary operator form as syntactic sugar. For example, 1 + 2 is just an operator form of 1.+(2). Operator is an alias for methods like +, - generally in the Veeyu programming language. Various special characters for operators are acceptable, but characters that cannot be inputted by common keyboard forms are restrained.

1 + 2                   # identifier: +
a -> <string>           # identifier: ->
"hello," ++ " world"    # identifier: ++

<set>(1..10) ∩ <set>(5..15)  # identifier: ∩
1 ≠ 2                        # identifier: ≠

Modules

Module names should be lowercase roman alphabets and digits and shorten. For example, there are many ways to name input/output module e.g. IO, InputOutput, input-output, inputoutput. However io is most suitable.

changed June 23, 2011