Snippet Kinds

CodeSnip is more than just a simple repository for your code snippets, it can do some other things like create compilable units and test-compile your code that mean it needs to know something about your code. For that reason each snippet must be identified as one of six kinds, and there are rules governing the layout of the source code for each kind. The six kinds are:

  1. A routine
    This is simple function or procedure, not a method.
    Learn more.
  2. A simple type definition
    This is a basic type definition, not a class, object or advanced record.
    Learn more.
  3. A constant definition
    This is what it says – a definition of one or more constants or typed constants.
    Learn more.
  4. A class / advanced record definition
    This is either a class or an advanced record (with methods). This type of snippet has separate declaration and definition sections.
    Learn more.
  5. A unit
    This comprises a complete source code unit. A unit is test compiled on its own and, for obvious reasons can't be inserted into generated units.
    Learn more.
  6. Freeform code
    A catch all for any snippet that is not one of the above types. Can contain anything. Freeform code can't be included in a generated unit and nether can it be test complied.
    Learn more.

If you want to be able use all of CodeSnip's functionality you must designate each of your snippets as one of the the first five kinds. Use the "learn more" links to find out what you need to do to comply with the requirements. Another way to learn is to examine the code from the main database, since it all conforms.

On the other hand if you only want to use CodeSnip as a repository for your code snippets, and don't want test compiling, just designate everything as freeform. Or mix and match.