Changes between Version 4 and Version 5 of Doc/panc/statements


Ignore:
Timestamp:
Mar 7, 2007, 1:32:10 PM (19 years ago)
Author:
/C=FR/O=CNRS/OU=UMR8607/CN=Michel Jouvin/emailAddress=jouvin@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Doc/panc/statements

    v4 v5  
    3131
    3232If a value already exists, the pan compiler will verify that the new value has a compatible type.  If not, it will terminate the processing with an error.
    33 
    34 == delete ==
    35 
    36 This statement will delete the named path.
    37 {{{
    38 delete path;
    39 }}}
    40 where the path is a string literal. 
    41 
    42 Note that this statement is '''deprecated'''.  The assignment statement
    43 {{{
    44 path = null;
    45 }}}
    46 provides the same functionality.  This statement will disappear in a future release of the pan compiler.
    47 
    48 == type ==
    49 
    50 Type definitions are critical for the validation of the generated machine profiles.  Types can be built up from the primitive pan types and arbitrary validation functions.  New types can be defined with
    51 {{{
    52 type identifier = type-spec;
    53 }}}
    54 Types referenced in the type-spec must already be defined.  See the Type section for more details on the syntax of the type specification.
    55 
    56 Note that the compiler keeps the distinct function and type namespaces.  One can define a function and type with the same names.
    57 
    58 == function ==
    59 
    60 Functions can be defined by the user.  These are arbitrary DML blocks bound to an identifier.  Once defined, functions can be called from any subsequent DML block.  The function definition syntax is:
    61 {{{
    62 function identifier = dml;
    63 }}}
    64 See the Function section for more information on user-defined functions and a list of built-in functions.
    65 
    66 Note that the compiler keeps the distinct function and type namespaces.  One can define a function and type with the same names.
    67 
    68 == variable ==
    69 
    70 Global variables can be defined.  These may be referenced from any DML block after being defined.  They may not be modified from a DML block; they can only be modified from a variable statement.  Like the assignment statement there are conditional and unconditional forms:
    71 {{{
    72 [ final ] variable identifier ?= dml;
    73 [ final ] variable identifier = dml;
    74 }}}
    75 For the conditional form, the DML block will only be evaluated and the assignment done if the variable does not exist or has the undef value.
    76 
    77 If the 'final' modifier is used, then the variable may not be subsequently modified.  Attempts to do so will result in a fatal error.
    78 
    79 Pan provides several automatic global variables: OBJECT, SELF, and LOADPATH (and their deprecated lowercase equivalents).  OBJECT contains the name of the object template being evaluated; it is a final variable.  SELF is the current value of a path referred to in an assignment or variable statement.  The SELF reference cannot be modified, but children of SELF may be.  LOADPATH can be used to modify the load path used to locate template for the include statement.
    80 
    81 Any valid identifier may be used to name a global variable.  To avoid conflicts with local variables, however, global variables are usually named in all uppercase; local variables in all lowercase.
    82 
    83 == bind ==
    84 
    85 The bind statement binds a type definition to a path.  Multiple types may be bound to a single path.  During the validation phase, the value corresponding to the named path will be checked against the bound types.  There are two variants:
    86 {{{
    87 bind path = type-spec;
    88 type path = type-spec;
    89 }}}
    90 See the Type section for a complete description of the type-spec syntax.  Note that the second form is '''deprecated''' and will disappear in a future release.
    91 
    92 == valid ==
    93 
    94 The valid statement binds a validation DML block to a path.  It has the form:
    95 {{{
    96 valid path = DML;
    97 }}}
    98 This is a convenience statement and has exactly the same effect as the statement:
    99 {{{
    100 bind path = element with DML;
    101 }}}
    102 The pan compiler internally implements this statement as the bind statement above.
    103 
    104