Frame

This is an old revision of Frame, edited by Trev at . The current revision is 141004.

Categorize page

A frame (frequently also referred to as block) is a language construct grouping a (possibly empty) sequence of statements (or instructions in the case of asm frames).

Available types

All frames but repeat … until are terminated by the word end. Frame types are distinguished by their corresponding opening words.

Style

Although not mandatory, it is customary to indent all code surrounded by frame markers by one level.

try
    openJar;
except
    throwATantrum;
end;

Some styles add another indentation level for nested or subordinate frame markers per se.

if apples = oranges then
  begin
    protest;
    halt(123);
  end;

As you can see from the examples above, it is customary to put frame delimiters isolated in their own line. Exempt of this guideline are of course frames accepting or requiring additional clauses to be syntactically complete:

repeat
    write('Enter a non-negative integer: ');
    readLn(i);
until i >= 0;
asm
    rdrand eax
    mov n, eax
END ['eax'];

Technical background

Frames frequently, but not always, turn up to be (conditional) jmp targets. Some compile-time optimizations require code to be structured in a certain way, frames setting boundaries for that.

Catgeory:Pascal