Naming conventions are important in any platform. If the naming conventions are followed in the library and by the developers of a project, you can remember the name of method, variable or whatever much better. This increases you productivity and the joy in your work, which is of course the most important thing in life.

Checking the name of a method in the documentation or source-code is quite tiresome. If you know the naming-scheme you only have to know the 'semantic' name of a method and you don't have to worry about the concrete syntax, which you can compose from the semantic name and the convention of the platform you are using.

Syntax

Strategies and rules

Naming conventions can be separated in conventions for the syntax of a name and conventions for the scheme of a name for a specific type of strategy. The conventions for the syntax of a name deal with the usage of dashes, underscores, lowercase, uppercase and so on. The conventions of the names themselves deal with standard name construction, indicating the 'kind' of the item (like is, set and get in the library of the JavaLanguage?)

In Stratego there are two important conventions for the syntax of names:

  • Names of strategies are written in lowercase where indiviual words of the name are separated by dashes. Examples: int-to-string, map, eval-exp.
  • Names of rules are written in CamelCase?. Examples: EvalExp, Desugar, Inline, TcExp

An exception to the strategy naming convention are strategies that merely alias or collect rules and do not perform a very interesting traversal. These strategies may just as well follow the convention for rule names. Example:
ElimDead = ElimDeadFun + ElimDeadRec
(where ElimDeadFun and ElimDeadRec are (possibly dynamic) rules).

Futhermore overlays are written like constructors, which are written in CamelCase?. Examples: BinOp, VarDec, Call.

Modules

to do.

Naming scheme

A naming scheme is helpful because it is a first indication of the task of a strategy. For any language holds: be precise and clear but prevent being to verbose.

Test-strategies

The first task that comes in mind is testing. Test-strategies verify whether the current term satisfies some condition or not. Test-strategies fail when the term doesn't satisfy the condition and leave the current term untouched otherwise. Test-strategies should be called is-*. Examples: is-int, is-list, is-Exp, is-Declared.

-- MartinBravenboer - 05 May 2002

Revision: r1.2 - 20 Jan 2004 - 14:55 - ArthurVanDam
Stratego > StrategoGlossary > NamingConventions
Copyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback