artefaktur
software engineer &        architecture

 
 
 
 

CfgScript Weak/Strong Pragma

| IncludeStatement | Pragma weak/strong | Pragma cast |

The pragma weak/strong controls how type declarations are requested by the CfgScript interpreter.


Content of this chapter:

   Syntax
   Usage




 Syntax

PragmaStrictWeakStatement
: '#' 'pragma' 'strict'
| '#' 'pragma' 'weak'
;

 Usage

#pragma strict force interpreter only to accept typed variable declarations.
#pragma weak - which is default - also allows ad hoc untyped variable declarations.


#pragma strict
int k = 3;
try {
  i = 42; // i is not declared before, trows an exception
  out.println("TEST FAILED");
} catch (acdk.cfgscript.ScriptException ex) {
  out.println("expected exception: " + ex.getMessage()); 
  out.println("TEST OK");
}

#pragma weak

j = 42; // weak mode should allow ad hoc variables
out.println("TEST OK");

Please refer also to  Variable Declaration.
 
Last modified 2005-05-08 22:25 by SYSTEM By Artefaktur, Ing. Bureau Kommer