export blocks inside a module

Topics: General, Language Specification
Jan 30, 2014 at 2:38 AM
Writing export in front of every variable I export is tedious. e.g. I have to write:
module Module {
  // Private vars...
  var p1 = "p1";
  // ...
  // Public vars...
  export var a1 = "a1";
  // ...
  export var aN = "aN";
}
When I'd rather write:
module Module {
  // Private vars...
  var p1 = "p1";
  // ...
  // Public vars...
  export {
    var a1 = "a1";
    // ...
    var aN = "aN";
  }
}
For more than a few exports, this is much less space. For debugging, when I sometimes want to export everything, it makes the syntax change very easy.

Thoughts?
Jun 22, 2014 at 4:42 AM
anyone out there?
Jun 22, 2014 at 6:50 AM
This is one work around:
class Module {
  // Public vars...
  static a1 = "a1";
  // ...
  static aN = "aN";
}

module Module {
  // Private vars...
  var p1 = "p1";
}
...though you'd be typing "static" instead of "var". That said, I'm all for the export shorthand in your example as well. ;)
Jun 22, 2014 at 7:14 AM
This seems great.