Declaring local variables inside a static function gives compile errors. The following example does not compile.

application test

entity Ent {
  intVal :: Int
  static function someInt() : Int {
    var i : Int := 1;
    var ent : Ent := Ent{ intVal := 2 };
    return i + ent.intVal;

define page root() { }

The following errors are given by WebDSL during compilation:

  • error: Global variable i has illegal type. Global variables can only be of a defined entity type, not a list, set or builtin type.
  • error: Variable ‘i’ not defined
  • error: Variable ‘ent’ not defined
Submitted by Christoffer Gersen on 16 May 2012 at 17:23

Log in to post comments