Skip to content

Instantly share code, notes, and snippets.

@natemort
Created December 5, 2014 04:17
Show Gist options
  • Select an option

  • Save natemort/cf769a81fbb28d0dd30d to your computer and use it in GitHub Desktop.

Select an option

Save natemort/cf769a81fbb28d0dd30d to your computer and use it in GitHub Desktop.
What should the value of someVariable be? Is it valid to initialize fields in an interface? Javascript says it's valid, and that the value should be 3. However, if someVariable isn't initialized in TestImplementation, the field gets stripped out and the generated javascript will result in an error. C# code is generated, but fails to compile, sta…
class Test {
static function main() {
var test = new TestImplementation();
trace(test.someVariable + "");
}
}
interface TestInterface {
public var someVariable:Int = 2;
}
class TestImplementation implements TestInterface {
public var someVariable:Int = 3;
public function new() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment